@@ -63,6 +63,7 @@ public function testCompleteWriteProcess()
63
63
$ responses = [
64
64
'createAsset1 ' => function (string $ method , string $ url , array $ options = []) use ($ expectedAuthHeader ): ResponseInterface {
65
65
$ expectedBody = http_build_query ([
66
+ 'id ' => 'messages__a ' ,
66
67
'text ' => 'a ' ,
67
68
'type ' => 'text ' ,
68
69
'default ' => 'untranslated ' ,
@@ -72,7 +73,7 @@ public function testCompleteWriteProcess()
72
73
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
73
74
$ this ->assertSame ($ expectedBody , $ options ['body ' ]);
74
75
75
- return new MockResponse ('{"id": "1337 "} ' , ['http_code ' => 201 ]);
76
+ return new MockResponse ('{"id": "messages__a "} ' , ['http_code ' => 201 ]);
76
77
},
77
78
'getTags1 ' => function (string $ method , string $ url , array $ options = []) use ($ expectedAuthHeader ): ResponseInterface {
78
79
$ this ->assertSame ('GET ' , $ method );
@@ -93,12 +94,13 @@ public function testCompleteWriteProcess()
93
94
$ this ->assertSame ('POST ' , $ method );
94
95
$ this ->assertSame ('https://localise.biz/api/tags/messages.json ' , $ url );
95
96
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
96
- $ this ->assertSame ('1337 ' , $ options ['body ' ]);
97
+ $ this ->assertSame ('messages__a ' , $ options ['body ' ]);
97
98
98
99
return new MockResponse ();
99
100
},
100
101
'createAsset2 ' => function (string $ method , string $ url , array $ options = []) use ($ expectedAuthHeader ): ResponseInterface {
101
102
$ expectedBody = http_build_query ([
103
+ 'id ' => 'validators__post.num_comments ' ,
102
104
'text ' => 'post.num_comments ' ,
103
105
'type ' => 'text ' ,
104
106
'default ' => 'untranslated ' ,
@@ -108,7 +110,7 @@ public function testCompleteWriteProcess()
108
110
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
109
111
$ this ->assertSame ($ expectedBody , $ options ['body ' ]);
110
112
111
- return new MockResponse ('{"id": "1234 "} ' , ['http_code ' => 201 ]);
113
+ return new MockResponse ('{"id": "validators__post.num_comments "} ' , ['http_code ' => 201 ]);
112
114
},
113
115
'getTags2 ' => function (string $ method , string $ url , array $ options = []) use ($ expectedAuthHeader ): ResponseInterface {
114
116
$ this ->assertSame ('GET ' , $ method );
@@ -129,7 +131,7 @@ public function testCompleteWriteProcess()
129
131
$ this ->assertSame ('POST ' , $ method );
130
132
$ this ->assertSame ('https://localise.biz/api/tags/validators.json ' , $ url );
131
133
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
132
- $ this ->assertSame ('1234 ' , $ options ['body ' ]);
134
+ $ this ->assertSame ('validators__post.num_comments ' , $ options ['body ' ]);
133
135
134
136
return new MockResponse ();
135
137
},
@@ -146,11 +148,11 @@ public function testCompleteWriteProcess()
146
148
$ this ->assertSame (['filter ' => 'messages ' ], $ options ['query ' ]);
147
149
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
148
150
149
- return new MockResponse ('[{"id":"1337 "}] ' );
151
+ return new MockResponse ('[{"id":"messages__a "}] ' );
150
152
},
151
153
'translateAsset1 ' => function (string $ method , string $ url , array $ options = []) use ($ expectedAuthHeader ): ResponseInterface {
152
154
$ this ->assertSame ('POST ' , $ method );
153
- $ this ->assertSame ('https://localise.biz/api/translations/1337 /en ' , $ url );
155
+ $ this ->assertSame ('https://localise.biz/api/translations/messages__a /en ' , $ url );
154
156
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
155
157
$ this ->assertSame ('trans_en_a ' , $ options ['body ' ]);
156
158
@@ -162,11 +164,11 @@ public function testCompleteWriteProcess()
162
164
$ this ->assertSame (['filter ' => 'validators ' ], $ options ['query ' ]);
163
165
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
164
166
165
- return new MockResponse ('[{"id":"1234 "}] ' );
167
+ return new MockResponse ('[{"id":"validators__post.num_comments "}] ' );
166
168
},
167
169
'translateAsset2 ' => function (string $ method , string $ url , array $ options = []) use ($ expectedAuthHeader ): ResponseInterface {
168
170
$ this ->assertSame ('POST ' , $ method );
169
- $ this ->assertSame ('https://localise.biz/api/translations/1234 /en ' , $ url );
171
+ $ this ->assertSame ('https://localise.biz/api/translations/validators__post.num_comments /en ' , $ url );
170
172
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
171
173
$ this ->assertSame ('{count, plural, one {# comment} other {# comments}} ' , $ options ['body ' ]);
172
174
@@ -193,11 +195,11 @@ public function testCompleteWriteProcess()
193
195
$ this ->assertSame (['filter ' => 'messages ' ], $ options ['query ' ]);
194
196
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
195
197
196
- return new MockResponse ('[{"id":"1337 "}] ' );
198
+ return new MockResponse ('[{"id":"messages__a "}] ' );
197
199
},
198
200
'translateAsset3 ' => function (string $ method , string $ url , array $ options = []) use ($ expectedAuthHeader ): ResponseInterface {
199
201
$ this ->assertSame ('POST ' , $ method );
200
- $ this ->assertSame ('https://localise.biz/api/translations/1337 /fr ' , $ url );
202
+ $ this ->assertSame ('https://localise.biz/api/translations/messages__a /fr ' , $ url );
201
203
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
202
204
$ this ->assertSame ('trans_fr_a ' , $ options ['body ' ]);
203
205
@@ -209,11 +211,11 @@ public function testCompleteWriteProcess()
209
211
$ this ->assertSame (['filter ' => 'validators ' ], $ options ['query ' ]);
210
212
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
211
213
212
- return new MockResponse ('[{"id":"1234 "}] ' );
214
+ return new MockResponse ('[{"id":"validators__post.num_comments "}] ' );
213
215
},
214
216
'translateAsset4 ' => function (string $ method , string $ url , array $ options = []) use ($ expectedAuthHeader ): ResponseInterface {
215
217
$ this ->assertSame ('POST ' , $ method );
216
- $ this ->assertSame ('https://localise.biz/api/translations/1234 /fr ' , $ url );
218
+ $ this ->assertSame ('https://localise.biz/api/translations/validators__post.num_comments /fr ' , $ url );
217
219
$ this ->assertSame ($ expectedAuthHeader , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
218
220
$ this ->assertSame ('{count, plural, one {# commentaire} other {# commentaires}} ' , $ options ['body ' ]);
219
221
@@ -321,11 +323,11 @@ function (string $method, string $url, array $options = []): ResponseInterface {
321
323
$ this ->assertSame ('https://localise.biz/api/assets?filter=messages ' , $ url );
322
324
$ this ->assertSame (['filter ' => 'messages ' ], $ options ['query ' ]);
323
325
324
- return new MockResponse ('[{"id":"1337 "}] ' );
326
+ return new MockResponse ('[{"id":"messages__a "}] ' );
325
327
},
326
328
function (string $ method , string $ url ): MockResponse {
327
329
$ this ->assertSame ('DELETE ' , $ method );
328
- $ this ->assertSame ('https://localise.biz/api/assets/1337 .json ' , $ url );
330
+ $ this ->assertSame ('https://localise.biz/api/assets/messages__a .json ' , $ url );
329
331
330
332
return new MockResponse ();
331
333
},
@@ -334,11 +336,11 @@ function (string $method, string $url, array $options = []): ResponseInterface {
334
336
$ this ->assertSame ('https://localise.biz/api/assets?filter=validators ' , $ url );
335
337
$ this ->assertSame (['filter ' => 'validators ' ], $ options ['query ' ]);
336
338
337
- return new MockResponse ('[{"id":"1234 "}] ' );
339
+ return new MockResponse ('[{"id":"validators__post.num_comments "}] ' );
338
340
},
339
341
function (string $ method , string $ url ): MockResponse {
340
342
$ this ->assertSame ('DELETE ' , $ method );
341
- $ this ->assertSame ('https://localise.biz/api/assets/1234 .json ' , $ url );
343
+ $ this ->assertSame ('https://localise.biz/api/assets/validators__post.num_comments .json ' , $ url );
342
344
343
345
return new MockResponse ();
344
346
},
0 commit comments