Skip to content

Commit f3543e1

Browse files
committed
docs
1 parent d9c04bf commit f3543e1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/LiveComponent/doc/index.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,6 +3123,20 @@ uses Symfony's test client to render and make requests to your components::
31233123
$response = $testComponent->call('redirect')->response(); // Symfony\Component\HttpFoundation\Response
31243124

31253125
$this->assertSame(302, $response->getStatusCode());
3126+
3127+
// authenticate a user ($user is instance of UserInterface)
3128+
$testComponent->actingAs($user);
3129+
3130+
// customize the test client
3131+
$client = self::getContainer()->get('test.client');
3132+
3133+
// do some stuff with the client (ie login user via form)
3134+
3135+
$testComponent = $this->createLiveComponent(
3136+
name: 'MyComponent',
3137+
data: ['foo' => 'bar'],
3138+
client: $client,
3139+
);
31263140
}
31273141
}
31283142

0 commit comments

Comments
 (0)