Skip to content

Commit 1d01162

Browse files
committed
fix: use method from metadata for live component test helper
1 parent 1a4bdc0 commit 1d01162

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/LiveComponent/src/Test/TestLiveComponent.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,16 @@ public function __construct(
5151
$this->metadataFactory->getMetadata($mounted->getName())
5252
);
5353

54-
$this->client->request('GET', $this->router->generate(
55-
$this->metadata->get('route'),
56-
[
57-
'_live_component' => $this->metadata->getName(),
58-
'props' => json_encode($props->getProps(), flags: \JSON_THROW_ON_ERROR),
59-
]
60-
));
54+
$this->client->request($this->metadata->get('method'),
55+
$this->router->generate(
56+
$this->metadata->get('route'),
57+
[
58+
'_live_component' => $this->metadata->getName(),
59+
]
60+
), [
61+
'data' => json_encode(['props' => $props->getProps()]),
62+
],
63+
);
6164
}
6265

6366
public function render(): RenderedComponent
@@ -141,7 +144,7 @@ private function request(array $content = [], string $action = null): self
141144
$csrfToken = $this->csrfToken();
142145

143146
$this->client->request(
144-
'POST',
147+
$this->metadata->get('method'),
145148
$this->router->generate(
146149
$this->metadata->get('route'),
147150
array_filter([

0 commit comments

Comments
 (0)