Skip to content

Commit

Permalink
Move variable assignments inside closures
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jun 26, 2024
1 parent d950c90 commit 5e7869f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/framework/tests/Unit/IncludesFacadeUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ public function testHtmlReturnsDefaultValueWhenNotFound()

public function testHtmlWithAndWithoutExtension()
{
$filename = 'foo.html';
$content = '<h1>foo bar</h1>';

$this->mockFilesystem(function ($filesystem) use ($content, $filename) {
$this->mockFilesystem(function ($filesystem) {
$filename = 'foo.html';
$content = '<h1>foo bar</h1>';
$filesystem->shouldReceive('exists')->with(Hyde::path('resources/includes/'.$filename))->andReturn(true);
$filesystem->shouldReceive('get')->with(Hyde::path('resources/includes/'.$filename))->andReturn($content);
});
Expand All @@ -113,10 +113,10 @@ public function testHtmlWithAndWithoutExtension()
public function testMarkdownReturnsRenderedPartial()
{
$filename = 'foo.md';
$content = '# foo bar';
$expected = "<h1>foo bar</h1>\n";

$this->mockFilesystem(function ($filesystem) use ($content, $filename) {
$this->mockFilesystem(function ($filesystem) use ($filename) {
$content = '# foo bar';
$filesystem->shouldReceive('exists')->with(Hyde::path('resources/includes/'.$filename))->andReturn(true);
$filesystem->shouldReceive('get')->with(Hyde::path('resources/includes/'.$filename))->andReturn($content);
});
Expand All @@ -140,11 +140,11 @@ public function testMarkdownReturnsRenderedDefaultValueWhenNotFound()

public function testMarkdownWithAndWithoutExtension()
{
$filename = 'foo.md';
$content = '# foo bar';
$expected = "<h1>foo bar</h1>\n";

$this->mockFilesystem(function ($filesystem) use ($content, $filename) {
$this->mockFilesystem(function ($filesystem) {
$content = '# foo bar';
$filename = 'foo.md';
$filesystem->shouldReceive('exists')->with(Hyde::path('resources/includes/'.$filename))->andReturn(true);
$filesystem->shouldReceive('get')->with(Hyde::path('resources/includes/'.$filename))->andReturn($content);
});
Expand Down Expand Up @@ -172,11 +172,11 @@ public function testBladeReturnsRenderedPartial()

public function testBladeWithAndWithoutExtension()
{
$filename = 'foo.blade.php';
$content = '{{ "foo bar" }}';
$expected = 'foo bar';

$this->mockFilesystem(function ($filesystem) use ($content, $filename) {
$this->mockFilesystem(function ($filesystem) use ($content) {
$filename = 'foo.blade.php';
$filesystem->shouldReceive('exists')->with(Hyde::path('resources/includes/'.$filename))->andReturn(true);
$filesystem->shouldReceive('get')->with(Hyde::path('resources/includes/'.$filename))->andReturn($content);
});
Expand Down

0 comments on commit 5e7869f

Please sign in to comment.