Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Sep 26, 2023
1 parent 3de9270 commit 1246cbd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
23 changes: 6 additions & 17 deletions tests/Integration/View/BladeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\View\Component;
use Orchestra\Testbench\TestCase;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;

class BladeTest extends TestCase
{
Expand Down Expand Up @@ -170,27 +171,15 @@ public function test_bound_name_attribute_can_be_used_if_using_short_slot_names_

public function testViewCacheCommandHandlesConfiguredBladeExtensions()
{
View::addExtension('sh', 'blade');
$path = View::make('different-extension')->getPath();
$compiled = Blade::getCompiledPath($path);

$this->artisan('view:clear');
$this->assertFileDoesNotExist($compiled);

View::addExtension('sh', 'blade');
$this->artisan('view:cache');

collect(Finder::create()
->in(Config::get('view.compiled'))
->files())->dd();

$this->assertStringEqualsFile($compiled, <<< COMPILED_BLADE
<?php
\$scriptMessage = 'Hello World';
?>
echo "<?php echo e(\$scriptMessage); ?>" > output.log
<?php /**PATH {$path} ENDPATH**/ ?>
COMPILED_BLADE);
$compiledFiles = Finder::create()->in(Config::get('view.compiled'))->files();
$found = collect($compiledFiles)
->contains(fn (SplFileInfo $file) => str_contains($file->getContents(), 'echo "<?php echo e($scriptMessage); ?>" > output.log'));
$this->assertTrue($found);

$this->artisan('view:clear');
}
Expand Down
4 changes: 0 additions & 4 deletions tests/Integration/View/templates/different-extension.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
@php
$scriptMessage = 'Hello World';
@endphp

echo "{{ $scriptMessage }}" > output.log

0 comments on commit 1246cbd

Please sign in to comment.