@@ -55,15 +55,15 @@ public function testCanRenderComponentAsHtmlOrJson(): void
55
55
56
56
$ this ->browser ()
57
57
->throwExceptions ()
58
- ->get ('/_components/component1? ' .http_build_query ($ dehydrated ))
58
+ ->get ('/_components/en/ component1? ' .http_build_query ($ dehydrated ))
59
59
->assertSuccessful ()
60
60
->assertHeaderContains ('Content-Type ' , 'html ' )
61
61
->assertContains ('Prop1: ' .$ entity ->id )
62
62
->assertContains ('Prop2: 2021-03-05 9:23 ' )
63
63
->assertContains ('Prop3: value3 ' )
64
64
->assertContains ('Prop4: (none) ' )
65
65
66
- ->get ('/_components/component1? ' .http_build_query ($ dehydrated ), ['headers ' => ['Accept ' => 'application/vnd.live-component+json ' ]])
66
+ ->get ('/_components/en/ component1? ' .http_build_query ($ dehydrated ), ['headers ' => ['Accept ' => 'application/vnd.live-component+json ' ]])
67
67
->assertSuccessful ()
68
68
->assertHeaderEquals ('Content-Type ' , 'application/vnd.live-component+json ' )
69
69
->assertJsonMatches ('keys(@) ' , ['html ' , 'data ' ])
@@ -94,26 +94,26 @@ public function testCanExecuteComponentAction(): void
94
94
95
95
$ this ->browser ()
96
96
->throwExceptions ()
97
- ->get ('/_components/component2? ' .http_build_query ($ dehydrated ))
97
+ ->get ('/_components/en/ component2? ' .http_build_query ($ dehydrated ))
98
98
->assertSuccessful ()
99
99
->assertHeaderContains ('Content-Type ' , 'html ' )
100
100
->assertContains ('Count: 1 ' )
101
101
->use (function (HtmlResponse $ response ) use (&$ token ) {
102
102
// get a valid token to use for actions
103
103
$ token = $ response ->crawler ()->filter ('div ' )->first ()->attr ('data-live-csrf-value ' );
104
104
})
105
- ->post ('/_components/component2/increase? ' .http_build_query ($ dehydrated ), [
105
+ ->post ('/_components/en/ component2/increase? ' .http_build_query ($ dehydrated ), [
106
106
'headers ' => ['X-CSRF-TOKEN ' => $ token ],
107
107
])
108
108
->assertSuccessful ()
109
109
->assertHeaderContains ('Content-Type ' , 'html ' )
110
110
->assertContains ('Count: 2 ' )
111
111
112
- ->get ('/_components/component2? ' .http_build_query ($ dehydrated ), ['headers ' => ['Accept ' => 'application/vnd.live-component+json ' ]])
112
+ ->get ('/_components/en/ component2? ' .http_build_query ($ dehydrated ), ['headers ' => ['Accept ' => 'application/vnd.live-component+json ' ]])
113
113
->assertSuccessful ()
114
114
->assertJsonMatches ('data.count ' , 1 )
115
115
->assertJsonMatches ("contains(html, 'Count: 1') " , true )
116
- ->post ('/_components/component2/increase? ' .http_build_query ($ dehydrated ), [
116
+ ->post ('/_components/en/ component2/increase? ' .http_build_query ($ dehydrated ), [
117
117
'headers ' => [
118
118
'Accept ' => 'application/vnd.live-component+json ' ,
119
119
'X-CSRF-TOKEN ' => $ token ,
@@ -128,22 +128,22 @@ public function testCanExecuteComponentAction(): void
128
128
public function testCannotExecuteComponentActionForGetRequest (): void
129
129
{
130
130
$ this ->browser ()
131
- ->get ('/_components/component2/increase ' )
131
+ ->get ('/_components/en/ component2/increase ' )
132
132
->assertStatus (405 )
133
133
;
134
134
}
135
135
136
136
public function testMissingCsrfTokenForComponentActionFails (): void
137
137
{
138
138
$ this ->browser ()
139
- ->post ('/_components/component2/increase ' )
139
+ ->post ('/_components/en/ component2/increase ' )
140
140
->assertStatus (400 )
141
141
;
142
142
143
143
try {
144
144
$ this ->browser ()
145
145
->throwExceptions ()
146
- ->post ('/_components/component2/increase ' )
146
+ ->post ('/_components/en/ component2/increase ' )
147
147
;
148
148
} catch (BadRequestHttpException $ e ) {
149
149
$ this ->assertSame ('Invalid CSRF token. ' , $ e ->getMessage ());
@@ -157,7 +157,7 @@ public function testMissingCsrfTokenForComponentActionFails(): void
157
157
public function testInvalidCsrfTokenForComponentActionFails (): void
158
158
{
159
159
$ this ->browser ()
160
- ->post ('/_components/component2/increase ' , [
160
+ ->post ('/_components/en/ component2/increase ' , [
161
161
'headers ' => ['X-CSRF-TOKEN ' => 'invalid ' ],
162
162
])
163
163
->assertStatus (400 )
@@ -166,7 +166,7 @@ public function testInvalidCsrfTokenForComponentActionFails(): void
166
166
try {
167
167
$ this ->browser ()
168
168
->throwExceptions ()
169
- ->post ('/_components/component2/increase ' , [
169
+ ->post ('/_components/en/ component2/increase ' , [
170
170
'headers ' => ['X-CSRF-TOKEN ' => 'invalid ' ],
171
171
])
172
172
;
@@ -196,7 +196,7 @@ public function testBeforeReRenderHookOnlyExecutedDuringAjax(): void
196
196
->visit ('/render-template/template1 ' )
197
197
->assertSuccessful ()
198
198
->assertSee ('BeforeReRenderCalled: No ' )
199
- ->get ('/_components/component2? ' .http_build_query ($ dehydrated ))
199
+ ->get ('/_components/en/ component2? ' .http_build_query ($ dehydrated ))
200
200
->assertSuccessful ()
201
201
->assertSee ('BeforeReRenderCalled: Yes ' )
202
202
;
@@ -218,19 +218,19 @@ public function testCanRedirectFromComponentAction(): void
218
218
219
219
$ this ->browser ()
220
220
->throwExceptions ()
221
- ->get ('/_components/component2? ' .http_build_query ($ dehydrated ))
221
+ ->get ('/_components/en/ component2? ' .http_build_query ($ dehydrated ))
222
222
->assertSuccessful ()
223
223
->use (function (HtmlResponse $ response ) use (&$ token ) {
224
224
// get a valid token to use for actions
225
225
$ token = $ response ->crawler ()->filter ('div ' )->first ()->attr ('data-live-csrf-value ' );
226
226
})
227
227
->interceptRedirects ()
228
- ->post ('/_components/component2/redirect? ' .http_build_query ($ dehydrated ), [
228
+ ->post ('/_components/en/ component2/redirect? ' .http_build_query ($ dehydrated ), [
229
229
'headers ' => ['X-CSRF-TOKEN ' => $ token ],
230
230
])
231
231
->assertRedirectedTo ('/ ' )
232
232
233
- ->post ('/_components/component2/redirect? ' .http_build_query ($ dehydrated ), [
233
+ ->post ('/_components/en/ component2/redirect? ' .http_build_query ($ dehydrated ), [
234
234
'headers ' => [
235
235
'Accept ' => 'application/json ' ,
236
236
'X-CSRF-TOKEN ' => $ token ,
0 commit comments