diff --git a/tests/FlightTest.php b/tests/FlightTest.php index d84336b..fe5b144 100644 --- a/tests/FlightTest.php +++ b/tests/FlightTest.php @@ -354,4 +354,20 @@ class FlightTest extends TestCase $this->expectOutputString('Thisisaroutewithhtml'); } + + public function testItDoesNotKeepThePreviousStateOfOneViewComponentUsingFlightRender(): void + { + Flight::set('flight.views.path', __DIR__ . '/views'); + + $this->expectOutputString("
Hi
\n
\n"); + Flight::render('myComponent', ['prop' => 'Hi']); + + set_error_handler(function (int $code, string $message): void { + $this->assertMatchesRegularExpression('/^Undefined variable:? \$?prop$/', $message); + }); + + Flight::render('myComponent'); + + restore_error_handler(); + } }