Skip to content

Commit

Permalink
Test includes usage from Blade view
Browse files Browse the repository at this point in the history
Emulates the actual usage of the Includes facade from a Blade view
  • Loading branch information
caendesilva committed Jun 26, 2024
1 parent 1d25d01 commit ffc8e7d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/framework/tests/Feature/IncludesFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Hyde\Support\Includes;
use Hyde\Hyde;
use Hyde\Testing\TestCase;
use Illuminate\Support\Facades\Blade;

/**
* @covers \Hyde\Support\Includes
Expand Down Expand Up @@ -216,4 +217,28 @@ public function testAdvancedBladePartialIsCompiledToHtml()
$this->file('resources/includes/advanced.blade.php', $blade);
$this->assertSame($expected, Includes::blade('advanced.blade.php'));
}

public function testIncludesUsageFromBladeView()
{
// Emulates the actual usage of the Includes facade from a Blade view.

$this->file('resources/includes/foo.blade.php', '{{ "foo bar" }}');
$this->file('resources/includes/foo.md', '# foo bar');
$this->file('resources/includes/foo.html', '<h1>foo bar</h1>');

$view = <<<'BLADE'
{!! Includes::blade('foo.blade.php') !!}
{!! Includes::markdown('foo.md') !!}
{!! Includes::html('foo.html') !!}
BLADE;

$expected = <<<'HTML'
foo bar
<h1>foo bar</h1>
<h1>foo bar</h1>
HTML;

$this->assertSame($expected, Blade::render($view));
}
}

0 comments on commit ffc8e7d

Please sign in to comment.