From 57febcf1454269c191073e48e4552d0fcd27249e Mon Sep 17 00:00:00 2001 From: Pascal Baljet Date: Tue, 15 Jul 2025 09:51:43 +0200 Subject: [PATCH] Remove old version checks --- tests/DirectiveTest.php | 41 +---------------------------------------- tests/ResponseTest.php | 4 ---- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/tests/DirectiveTest.php b/tests/DirectiveTest.php index f07dad69..356f2348 100644 --- a/tests/DirectiveTest.php +++ b/tests/DirectiveTest.php @@ -6,14 +6,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Config; use Illuminate\View\Compilers\BladeCompiler; -use Illuminate\View\Engines\PhpEngine; -use Illuminate\View\Factory; -use Illuminate\View\View; use Inertia\Directive; use Inertia\Ssr\Gateway; use Inertia\Tests\Stubs\FakeGateway; use Mockery as m; -use Throwable; class DirectiveTest extends TestCase { @@ -47,42 +43,7 @@ protected function tearDown(): void protected function renderView($contents, $data = []) { - // Laravel 8+ only: https://github.com/laravel/framework/pull/40425 - if (method_exists(BladeCompiler::class, 'render')) { - return Blade::render($contents, $data, true); - } - - // First, we'll create a temporary file, and use compileString to 'emulate' compilation of our view. - // This skips caching, and a bunch of other logic that's not relevant for what we need here. - $path = tempnam(sys_get_temp_dir(), 'inertia_tests_render_'); - file_put_contents($path, $this->compiler->compileString($contents)); - - // Next, we'll 'render' out compiled view. - $view = new View( - m::mock(Factory::class), - new PhpEngine(new Filesystem), - 'fake-view', - $path, - $data - ); - - // Then, we'll just hack and slash our way to success.. - $view->getFactory()->allows('incrementRender')->once(); - $view->getFactory()->allows('callComposer')->once(); - $view->getFactory()->allows('getShared')->once()->andReturn([]); - $view->getFactory()->allows('decrementRender')->once(); - $view->getFactory()->allows('flushStateIfDoneRendering')->once(); - $view->getFactory()->allows('flushState'); - - try { - $output = $view->render(); - @unlink($path); - } catch (Throwable $e) { - @unlink($path); - throw $e; - } - - return $output; + return Blade::render($contents, $data, true); } public function test_inertia_directive_renders_the_root_element(): void diff --git a/tests/ResponseTest.php b/tests/ResponseTest.php index 9014ba28..9763386a 100644 --- a/tests/ResponseTest.php +++ b/tests/ResponseTest.php @@ -893,10 +893,6 @@ public function test_responsable_with_invalid_key(): void public function test_the_page_url_is_prefixed_with_the_proxy_prefix(): void { - if (version_compare(app()->version(), '7', '<')) { - $this->markTestSkipped('This test requires Laravel 7 or higher.'); - } - Request::setTrustedProxies(['1.2.3.4'], Request::HEADER_X_FORWARDED_PREFIX); $request = Request::create('/user/123', 'GET');