diff --git a/src/LiveComponent/src/Test/TestLiveComponent.php b/src/LiveComponent/src/Test/TestLiveComponent.php index a0300723142..fcfa8b9a545 100644 --- a/src/LiveComponent/src/Test/TestLiveComponent.php +++ b/src/LiveComponent/src/Test/TestLiveComponent.php @@ -51,13 +51,25 @@ public function __construct( $this->metadataFactory->getMetadata($mounted->getName()) ); - $this->client->request('GET', $this->router->generate( - $this->metadata->get('route'), - [ - '_live_component' => $this->metadata->getName(), - 'props' => json_encode($props->getProps(), flags: \JSON_THROW_ON_ERROR), - ] - )); + if ('POST' === strtoupper($this->metadata->get('method'))) { + $this->client->request( + 'POST', + $this->router->generate($this->metadata->get('route'), [ + '_live_component' => $this->metadata->getName(), + ]), + [ + 'data' => json_encode(['props' => $props->getProps()], flags: \JSON_THROW_ON_ERROR), + ], + ); + } else { + $this->client->request('GET', $this->router->generate( + $this->metadata->get('route'), + [ + '_live_component' => $this->metadata->getName(), + 'props' => json_encode($props->getProps(), flags: \JSON_THROW_ON_ERROR), + ] + )); + } } public function render(): RenderedComponent