@@ -31,17 +31,19 @@ public function testCanBatchActions(): void
31
31
32
32
$ this ->browser ()
33
33
->throwExceptions ()
34
- ->get ('/_components/with_actions ' , ['json ' => ['props ' => $ dehydrated ->getProps ()]])
34
+ ->get ('/_components/with_actions ' , ['query ' => ['props ' => json_encode ( $ dehydrated ->getProps () )]])
35
35
->assertSuccessful ()
36
36
->assertSee ('initial ' )
37
37
->use (function (Crawler $ crawler , KernelBrowser $ browser ) {
38
38
$ rootElement = $ crawler ->filter ('ul ' )->first ();
39
39
$ liveProps = json_decode ($ rootElement ->attr ('data-live-props-value ' ), true );
40
40
41
41
$ browser ->post ('/_components/with_actions/add ' , [
42
- 'json ' => [
43
- 'props ' => $ liveProps ,
44
- 'args ' => ['what ' => 'first ' ],
42
+ 'body ' => [
43
+ 'data ' => json_encode ([
44
+ 'props ' => $ liveProps ,
45
+ 'args ' => ['what ' => 'first ' ],
46
+ ]),
45
47
],
46
48
'headers ' => ['X-CSRF-TOKEN ' => $ crawler ->filter ('ul ' )->first ()->attr ('data-live-csrf-value ' )],
47
49
]);
@@ -53,13 +55,15 @@ public function testCanBatchActions(): void
53
55
$ liveProps = json_decode ($ rootElement ->attr ('data-live-props-value ' ), true );
54
56
55
57
$ browser ->post ('/_components/with_actions/_batch ' , [
56
- 'json ' => [
57
- 'props ' => $ liveProps ,
58
- 'actions ' => [
59
- ['name ' => 'add ' , 'args ' => ['what ' => 'second ' ]],
60
- ['name ' => 'add ' , 'args ' => ['what ' => 'third ' ]],
61
- ['name ' => 'add ' , 'args ' => ['what ' => 'fourth ' ]],
62
- ],
58
+ 'body ' => [
59
+ 'data ' => json_encode ([
60
+ 'props ' => $ liveProps ,
61
+ 'actions ' => [
62
+ ['name ' => 'add ' , 'args ' => ['what ' => 'second ' ]],
63
+ ['name ' => 'add ' , 'args ' => ['what ' => 'third ' ]],
64
+ ['name ' => 'add ' , 'args ' => ['what ' => 'fourth ' ]],
65
+ ],
66
+ ]),
63
67
],
64
68
'headers ' => ['X-CSRF-TOKEN ' => $ crawler ->filter ('ul ' )->first ()->attr ('data-live-csrf-value ' )],
65
69
]);
@@ -78,21 +82,23 @@ public function testCanBatchActionsWithAlternateRoute(): void
78
82
79
83
$ this ->browser ()
80
84
->throwExceptions ()
81
- ->get ('/alt/alternate_route ' , ['json ' => ['props ' => $ dehydrated ->getProps ()]])
85
+ ->get ('/alt/alternate_route ' , ['query ' => ['props ' => json_encode ( $ dehydrated ->getProps () )]])
82
86
->assertSuccessful ()
83
87
->assertSee ('count: 0 ' )
84
88
->use (function (Crawler $ crawler , KernelBrowser $ browser ) {
85
89
$ rootElement = $ crawler ->filter ('div ' )->first ();
86
90
$ liveProps = json_decode ($ rootElement ->attr ('data-live-props-value ' ), true );
87
91
88
92
$ browser ->post ('/alt/alternate_route/_batch ' , [
89
- 'json ' => [
90
- 'props ' => $ liveProps ,
91
- 'actions ' => [
92
- ['name ' => 'increase ' ],
93
- ['name ' => 'increase ' ],
94
- ['name ' => 'increase ' ],
95
- ],
93
+ 'body ' => [
94
+ 'data ' => json_encode ([
95
+ 'props ' => $ liveProps ,
96
+ 'actions ' => [
97
+ ['name ' => 'increase ' ],
98
+ ['name ' => 'increase ' ],
99
+ ['name ' => 'increase ' ],
100
+ ],
101
+ ]),
96
102
],
97
103
'headers ' => ['X-CSRF-TOKEN ' => $ rootElement ->attr ('data-live-csrf-value ' )],
98
104
]);
@@ -122,21 +128,23 @@ public function testRedirect(): void
122
128
123
129
$ this ->browser ()
124
130
->throwExceptions ()
125
- ->get ('/_components/with_actions ' , ['json ' => ['props ' => $ dehydrated ->getProps ()]])
131
+ ->get ('/_components/with_actions ' , ['query ' => ['props ' => json_encode ( $ dehydrated ->getProps () )]])
126
132
->assertSuccessful ()
127
133
->interceptRedirects ()
128
134
->use (function (Crawler $ crawler , KernelBrowser $ browser ) {
129
135
$ rootElement = $ crawler ->filter ('ul ' )->first ();
130
136
$ liveProps = json_decode ($ rootElement ->attr ('data-live-props-value ' ), true );
131
137
132
138
$ browser ->post ('/_components/with_actions/_batch ' , [
133
- 'json ' => [
134
- 'props ' => $ liveProps ,
135
- 'actions ' => [
136
- ['name ' => 'add ' , 'args ' => ['what ' => 'second ' ]],
137
- ['name ' => 'redirect ' ],
138
- ['name ' => 'add ' , 'args ' => ['what ' => 'fourth ' ]],
139
- ],
139
+ 'body ' => [
140
+ 'data ' => json_encode ([
141
+ 'props ' => $ liveProps ,
142
+ 'actions ' => [
143
+ ['name ' => 'add ' , 'args ' => ['what ' => 'second ' ]],
144
+ ['name ' => 'redirect ' ],
145
+ ['name ' => 'add ' , 'args ' => ['what ' => 'fourth ' ]],
146
+ ],
147
+ ]),
140
148
],
141
149
'headers ' => ['X-CSRF-TOKEN ' => $ crawler ->filter ('ul ' )->first ()->attr ('data-live-csrf-value ' )],
142
150
]);
@@ -150,20 +158,22 @@ public function testException(): void
150
158
$ dehydrated = $ this ->dehydrateComponent ($ this ->mountComponent ('with_actions ' ));
151
159
152
160
$ this ->browser ()
153
- ->get ('/_components/with_actions ' , ['json ' => ['props ' => $ dehydrated ->getProps ()]])
161
+ ->get ('/_components/with_actions ' , ['query ' => ['props ' => json_encode ( $ dehydrated ->getProps () )]])
154
162
->assertSuccessful ()
155
163
->use (function (Crawler $ crawler , KernelBrowser $ browser ) {
156
164
$ rootElement = $ crawler ->filter ('ul ' )->first ();
157
165
$ liveProps = json_decode ($ rootElement ->attr ('data-live-props-value ' ), true );
158
166
159
167
$ browser ->post ('/_components/with_actions/_batch ' , [
160
- 'json ' => [
161
- 'props ' => $ liveProps ,
162
- 'actions ' => [
163
- ['name ' => 'add ' , 'args ' => ['what ' => 'second ' ]],
164
- ['name ' => 'exception ' ],
165
- ['name ' => 'add ' , 'args ' => ['what ' => 'fourth ' ]],
166
- ],
168
+ 'body ' => [
169
+ 'data ' => json_encode ([
170
+ 'props ' => $ liveProps ,
171
+ 'actions ' => [
172
+ ['name ' => 'add ' , 'args ' => ['what ' => 'second ' ]],
173
+ ['name ' => 'exception ' ],
174
+ ['name ' => 'add ' , 'args ' => ['what ' => 'fourth ' ]],
175
+ ],
176
+ ]),
167
177
],
168
178
'headers ' => ['X-CSRF-TOKEN ' => $ crawler ->filter ('ul ' )->first ()->attr ('data-live-csrf-value ' )],
169
179
]);
@@ -178,20 +188,22 @@ public function testCannotBatchWithNonLiveAction(): void
178
188
$ dehydrated = $ this ->dehydrateComponent ($ this ->mountComponent ('with_actions ' ));
179
189
180
190
$ this ->browser ()
181
- ->get ('/_components/with_actions ' , ['json ' => ['props ' => $ dehydrated ->getProps ()]])
191
+ ->get ('/_components/with_actions ' , ['query ' => ['props ' => json_encode ( $ dehydrated ->getProps () )]])
182
192
->assertSuccessful ()
183
193
->use (function (Crawler $ crawler , KernelBrowser $ browser ) {
184
194
$ rootElement = $ crawler ->filter ('ul ' )->first ();
185
195
$ liveProps = json_decode ($ rootElement ->attr ('data-live-props-value ' ), true );
186
196
187
197
$ browser ->post ('/_components/with_actions/_batch ' , [
188
- 'json ' => [
189
- 'props ' => $ liveProps ,
190
- 'actions ' => [
191
- ['name ' => 'add ' , 'args ' => ['what ' => 'second ' ]],
192
- ['name ' => 'nonLive ' ],
193
- ['name ' => 'add ' , 'args ' => ['what ' => 'fourth ' ]],
194
- ],
198
+ 'body ' => [
199
+ 'data ' => json_encode ([
200
+ 'props ' => $ liveProps ,
201
+ 'actions ' => [
202
+ ['name ' => 'add ' , 'args ' => ['what ' => 'second ' ]],
203
+ ['name ' => 'nonLive ' ],
204
+ ['name ' => 'add ' , 'args ' => ['what ' => 'fourth ' ]],
205
+ ],
206
+ ]),
195
207
],
196
208
'headers ' => ['X-CSRF-TOKEN ' => $ crawler ->filter ('ul ' )->first ()->attr ('data-live-csrf-value ' )],
197
209
]);
0 commit comments