diff --git a/packages/framework/src/Support/Includes.php b/packages/framework/src/Support/Includes.php index 2f02b38d801..fc2b4e377c2 100644 --- a/packages/framework/src/Support/Includes.php +++ b/packages/framework/src/Support/Includes.php @@ -16,7 +16,7 @@ * * Both Markdown and Blade includes will be rendered to HTML. */ -class Includes +class Include { /** * @var string The directory where includes are stored. diff --git a/packages/framework/tests/Unit/IncludesFacadeUnitTest.php b/packages/framework/tests/Unit/IncludesFacadeUnitTest.php index 33c226116c7..853b000adf8 100644 --- a/packages/framework/tests/Unit/IncludesFacadeUnitTest.php +++ b/packages/framework/tests/Unit/IncludesFacadeUnitTest.php @@ -99,10 +99,10 @@ public function testHtmlReturnsDefaultValueWhenNotFound() public function testHtmlWithAndWithoutExtension() { - $this->mockFilesystem(function ($filesystem) { $filename = 'foo.html'; $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); }); @@ -117,6 +117,7 @@ public function testMarkdownReturnsRenderedPartial() $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); }); @@ -145,6 +146,7 @@ public function testMarkdownWithAndWithoutExtension() $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); }); @@ -161,6 +163,7 @@ public function testBladeReturnsRenderedPartial() $this->mockFilesystem(function ($filesystem) use ($expected, $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); @@ -172,11 +175,11 @@ public function testBladeReturnsRenderedPartial() public function testBladeWithAndWithoutExtension() { - $this->mockFilesystem(function ($filesystem) { $expected = 'foo bar'; $content = '{{ "foo bar" }}'; $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); @@ -194,6 +197,7 @@ public function testBladeReturnsDefaultValueWhenNotFound() $this->mockFilesystem(function ($filesystem) use ($default, $expected, $filename) { $filesystem->shouldReceive('exists')->with(Hyde::path('resources/includes/'.$filename))->andReturn(false); + Blade::shouldReceive('render')->with($default)->andReturn($expected); });