Skip to content

Commit bab0c0c

Browse files
authored
Merge pull request #763 from inertiajs/old-laravel-cleanup
[2.x] Remove old version checks
2 parents 2074ae3 + 57febcf commit bab0c0c

File tree

2 files changed

+1
-44
lines changed

2 files changed

+1
-44
lines changed

tests/DirectiveTest.php

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@
66
use Illuminate\Support\Facades\Blade;
77
use Illuminate\Support\Facades\Config;
88
use Illuminate\View\Compilers\BladeCompiler;
9-
use Illuminate\View\Engines\PhpEngine;
10-
use Illuminate\View\Factory;
11-
use Illuminate\View\View;
129
use Inertia\Directive;
1310
use Inertia\Ssr\Gateway;
1411
use Inertia\Tests\Stubs\FakeGateway;
1512
use Mockery as m;
16-
use Throwable;
1713

1814
class DirectiveTest extends TestCase
1915
{
@@ -47,42 +43,7 @@ protected function tearDown(): void
4743

4844
protected function renderView($contents, $data = [])
4945
{
50-
// Laravel 8+ only: https://github.com/laravel/framework/pull/40425
51-
if (method_exists(BladeCompiler::class, 'render')) {
52-
return Blade::render($contents, $data, true);
53-
}
54-
55-
// First, we'll create a temporary file, and use compileString to 'emulate' compilation of our view.
56-
// This skips caching, and a bunch of other logic that's not relevant for what we need here.
57-
$path = tempnam(sys_get_temp_dir(), 'inertia_tests_render_');
58-
file_put_contents($path, $this->compiler->compileString($contents));
59-
60-
// Next, we'll 'render' out compiled view.
61-
$view = new View(
62-
m::mock(Factory::class),
63-
new PhpEngine(new Filesystem),
64-
'fake-view',
65-
$path,
66-
$data
67-
);
68-
69-
// Then, we'll just hack and slash our way to success..
70-
$view->getFactory()->allows('incrementRender')->once();
71-
$view->getFactory()->allows('callComposer')->once();
72-
$view->getFactory()->allows('getShared')->once()->andReturn([]);
73-
$view->getFactory()->allows('decrementRender')->once();
74-
$view->getFactory()->allows('flushStateIfDoneRendering')->once();
75-
$view->getFactory()->allows('flushState');
76-
77-
try {
78-
$output = $view->render();
79-
@unlink($path);
80-
} catch (Throwable $e) {
81-
@unlink($path);
82-
throw $e;
83-
}
84-
85-
return $output;
46+
return Blade::render($contents, $data, true);
8647
}
8748

8849
public function test_inertia_directive_renders_the_root_element(): void

tests/ResponseTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,10 +893,6 @@ public function test_responsable_with_invalid_key(): void
893893

894894
public function test_the_page_url_is_prefixed_with_the_proxy_prefix(): void
895895
{
896-
if (version_compare(app()->version(), '7', '<')) {
897-
$this->markTestSkipped('This test requires Laravel 7 or higher.');
898-
}
899-
900896
Request::setTrustedProxies(['1.2.3.4'], Request::HEADER_X_FORWARDED_PREFIX);
901897

902898
$request = Request::create('/user/123', 'GET');

0 commit comments

Comments
 (0)