Skip to content

Commit

Permalink
Updated testSpatieLaravelIgnitionCompatibility test as lastCompiled i…
Browse files Browse the repository at this point in the history
…s now a real protected property on the test harness
  • Loading branch information
asgrim committed Aug 24, 2023
1 parent 5a91348 commit 8e6d687
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions tests/Unit/Laravel/View/Engine/ScoutViewEngineDecoratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,25 +173,20 @@ public function testScoutViewEngineDecoratorImplementsAllPublicApiOfCompilerEngi
}
}

/**
* The `spatie/laravel-ignition` package depends on the engine having a property called `lastCompiled`, which
* only exists in the `\Illuminate\View\Engines\CompilerEngine` Blade Compiler. The implementation does sort of
* account for decoration, but it expects the property to be called `engine`. Therefore, in this test, we
* invoke the problematic consumer to ensure our decorated view engine conforms to this assumption.
*
* @link https://github.com/spatie/laravel-ignition/blob/d53075177ee0c710fbf588b8569f50435e1da054/src/Views/ViewExceptionMapper.php#L124-L130
*/
public function testSpatieLaravelIgnitionCompatibility(): void
{
if (! class_exists(ViewExceptionMapper::class)) {
self::markTestSkipped('Test depends on `spatie/laravel-ignition`, but it is not installed');
}

/**
* The `spatie/laravel-ignition` package depends on the engine having a property called `lastCompiled`, which
* only exists in the `\Illuminate\View\Engines\CompilerEngine` Blade Compiler. The implementation does sort of
* account for decoration, but it expects the property to be called `engine`. Therefore, in this test, we
* invoke the problematic consumer to ensure our decorated view engine conforms to this assumption.
*
* @link https://github.com/spatie/laravel-ignition/blob/d53075177ee0c710fbf588b8569f50435e1da054/src/Views/ViewExceptionMapper.php#L124-L130
*
* @noinspection PhpPossiblePolymorphicInvocationInspection
* @psalm-suppress NoInterfaceProperties
*/
$this->realEngine->lastCompiled = [];

$viewEngineResolver = new EngineResolver();
$viewEngineResolver->register('blade', function () {
return $this->viewEngineDecorator;
Expand Down

0 comments on commit 8e6d687

Please sign in to comment.