Skip to content

Commit 50ac534

Browse files
committed
feat(live): allow passing custom test client to InteractsWithLiveComponents::createLiveComponent
1 parent 7412bd2 commit 50ac534

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/LiveComponent/src/Test/InteractsWithLiveComponents.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\UX\LiveComponent\Test;
1313

14+
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
1415
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1516
use Symfony\UX\TwigComponent\ComponentFactory;
1617

@@ -19,7 +20,7 @@
1920
*/
2021
trait InteractsWithLiveComponents
2122
{
22-
protected function createLiveComponent(string $name, array $data = []): TestLiveComponent
23+
protected function createLiveComponent(string $name, array $data = [], ?KernelBrowser $client = null): TestLiveComponent
2324
{
2425
if (!$this instanceof KernelTestCase) {
2526
throw new \LogicException(sprintf('The "%s" trait can only be used on "%s" classes.', __TRAIT__, KernelTestCase::class));
@@ -37,7 +38,7 @@ protected function createLiveComponent(string $name, array $data = []): TestLive
3738
$metadata,
3839
$data,
3940
$factory,
40-
self::getContainer()->get('test.client'),
41+
$client ?? self::getContainer()->get('test.client'),
4142
self::getContainer()->get('ux.live_component.component_hydrator'),
4243
self::getContainer()->get('ux.live_component.metadata_factory'),
4344
self::getContainer()->get('router'),

0 commit comments

Comments
 (0)