Skip to content

Commit e34bf4a

Browse files
committed
Update ComponentTest.php
1 parent 044353b commit e34bf4a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/ComponentTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,22 @@ public function test_head_component_without_slot_matches_directive_output_when_s
160160
$this->assertSame($directive, $component);
161161
}
162162

163+
public function test_components_do_not_create_cached_view_files_per_request(): void
164+
{
165+
Config::set(['inertia.ssr.enabled' => true]);
166+
167+
$viewCachePath = $this->app['config']['view.compiled'];
168+
$view = '<x-inertia::head><title>Fallback</title></x-inertia::head><x-inertia::app />';
169+
170+
$this->renderView($view, ['page' => self::EXAMPLE_PAGE_OBJECT]);
171+
$cachedViews = glob($viewCachePath.'/*.php');
172+
173+
$this->app->forgetScopedInstances();
174+
175+
$this->renderView($view, ['page' => ['component' => 'Different', 'props' => ['foo' => 'bar']]]);
176+
$this->assertSame($cachedViews, glob($viewCachePath.'/*.php'));
177+
}
178+
163179
public function test_ssr_state_is_scoped_and_does_not_leak_between_requests(): void
164180
{
165181
Config::set(['inertia.ssr.enabled' => true]);

0 commit comments

Comments
 (0)