@@ -72,7 +72,7 @@ public function testCanExecuteComponentAction(): void
72
72
})
73
73
->post ('/_components/component2/increase ' , [
74
74
'headers ' => ['X-CSRF-TOKEN ' => $ token ],
75
- 'body ' => json_encode ($ dehydrated ),
75
+ 'body ' => json_encode ([ ' data ' => $ dehydrated] ),
76
76
])
77
77
->assertSuccessful ()
78
78
->assertHeaderContains ('Content-Type ' , 'html ' )
@@ -145,7 +145,7 @@ public function testDisabledCsrfTokenForComponentDoesNotFail(): void
145
145
->assertHeaderContains ('Content-Type ' , 'html ' )
146
146
->assertContains ('Count: 1 ' )
147
147
->post ('/_components/disabled_csrf/increase ' , [
148
- 'body ' => json_encode ($ dehydrated ),
148
+ 'body ' => json_encode ([ ' data ' => $ dehydrated] ),
149
149
])
150
150
->assertSuccessful ()
151
151
->assertHeaderContains ('Content-Type ' , 'html ' )
@@ -184,7 +184,7 @@ public function testCanRedirectFromComponentAction(): void
184
184
// with no custom header, it redirects like a normal browser
185
185
->post ('/_components/component2/redirect ' , [
186
186
'headers ' => ['X-CSRF-TOKEN ' => $ token ],
187
- 'body ' => json_encode ($ dehydrated ),
187
+ 'body ' => json_encode ([ ' data ' => $ dehydrated] ),
188
188
])
189
189
->assertRedirectedTo ('/ ' )
190
190
@@ -194,7 +194,7 @@ public function testCanRedirectFromComponentAction(): void
194
194
'Accept ' => 'application/vnd.live-component+html ' ,
195
195
'X-CSRF-TOKEN ' => $ token ,
196
196
],
197
- 'body ' => json_encode ($ dehydrated ),
197
+ 'body ' => json_encode ([ ' data ' => $ dehydrated] ),
198
198
])
199
199
->assertStatus (204 )
200
200
->assertHeaderEquals ('Location ' , '/ ' )
@@ -206,10 +206,10 @@ public function testInjectsLiveArgs(): void
206
206
$ dehydrated = $ this ->dehydrateComponent ($ this ->mountComponent ('component6 ' ));
207
207
$ token = null ;
208
208
209
- $ argsQueryParams = http_build_query ([ ' args ' => http_build_query ([ ' arg1 ' => 'hello ' , 'arg2 ' => 666 , 'custom ' => '33.3 ' ])]) ;
209
+ $ arguments = [ ' arg1 ' => 'hello ' , 'arg2 ' => 666 , 'custom ' => '33.3 ' ];
210
210
$ this ->browser ()
211
211
->throwExceptions ()
212
- ->get ('/_components/component6?data= ' .urlencode (json_encode ($ dehydrated )). ' & ' . $ argsQueryParams )
212
+ ->get ('/_components/component6?data= ' .urlencode (json_encode ($ dehydrated )))
213
213
->assertSuccessful ()
214
214
->assertHeaderContains ('Content-Type ' , 'html ' )
215
215
->assertContains ('Arg1: not provided ' )
@@ -219,9 +219,12 @@ public function testInjectsLiveArgs(): void
219
219
// get a valid token to use for actions
220
220
$ token = $ response ->crawler ()->filter ('div ' )->first ()->attr ('data-live-csrf-value ' );
221
221
})
222
- ->post ('/_components/component6/inject? ' . $ argsQueryParams , [
222
+ ->post ('/_components/component6/inject ' , [
223
223
'headers ' => ['X-CSRF-TOKEN ' => $ token ],
224
- 'body ' => json_encode ($ dehydrated ),
224
+ 'body ' => json_encode ([
225
+ 'data ' => $ dehydrated ,
226
+ 'args ' => $ arguments ,
227
+ ]),
225
228
])
226
229
->assertSuccessful ()
227
230
->assertHeaderContains ('Content-Type ' , 'html ' )
0 commit comments