Skip to content

Commit c7d37bd

Browse files
committed
Tests: Use native render when possible
See laravel/framework#40425
1 parent f90c472 commit c7d37bd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/DirectiveTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Inertia\Tests;
44

55
use Illuminate\Filesystem\Filesystem;
6+
use Illuminate\Support\Facades\Blade;
67
use Illuminate\Support\Facades\Config;
78
use Illuminate\View\Compilers\BladeCompiler;
89
use Illuminate\View\Engines\PhpEngine;
@@ -50,6 +51,11 @@ protected function tearDown(): void
5051

5152
protected function renderView($contents, $data = [])
5253
{
54+
// Laravel 8+ only: https://github.com/laravel/framework/pull/40425
55+
if (method_exists(BladeCompiler::class, 'render')) {
56+
return Blade::render($contents, $data, false);
57+
}
58+
5359
// First, we'll create a temporary file, and use compileString to 'emulate' compilation of our view.
5460
// This skips caching, and a bunch of other logic that's not relevant for what we need here.
5561
$path = tempnam(sys_get_temp_dir(), 'inertia_tests_render_');

0 commit comments

Comments
 (0)