@@ -69,14 +69,14 @@ public function testCompleteWriteProcess()
69
69
70
70
$ this ->assertSame ('POST ' , $ method );
71
71
$ this ->assertSame ('https://api.lokalise.com/api2/projects/PROJECT_ID/languages ' , $ url );
72
- $ this ->assertSame ($ expectedBody , $ options ['body ' ]);
72
+ $ this ->assertJsonStringEqualsJsonString ($ expectedBody , $ options ['body ' ]);
73
73
74
74
return new MockResponse ();
75
75
};
76
76
77
77
$ getKeysIdsForMessagesDomainResponse = function (string $ method , string $ url , array $ options = []): ResponseInterface {
78
78
$ expectedQuery = [
79
- 'filter_keys ' => 'a ' ,
79
+ 'filter_keys ' => 'young_dog ' ,
80
80
'filter_filenames ' => 'messages.xliff ' ,
81
81
];
82
82
@@ -104,7 +104,7 @@ public function testCompleteWriteProcess()
104
104
$ expectedBody = json_encode ([
105
105
'keys ' => [
106
106
[
107
- 'key_name ' => 'a ' ,
107
+ 'key_name ' => 'young_dog ' ,
108
108
'platforms ' => ['web ' ],
109
109
'filenames ' => [
110
110
'web ' => 'messages.xliff ' ,
@@ -117,11 +117,11 @@ public function testCompleteWriteProcess()
117
117
]);
118
118
119
119
$ this ->assertSame ('POST ' , $ method );
120
- $ this ->assertSame ($ expectedBody , $ options ['body ' ]);
120
+ $ this ->assertJsonStringEqualsJsonString ($ expectedBody , $ options ['body ' ]);
121
121
122
122
return new MockResponse (json_encode (['keys ' => [
123
123
[
124
- 'key_name ' => ['web ' => 'a ' ],
124
+ 'key_name ' => ['web ' => 'young_dog ' ],
125
125
'key_id ' => 29 ,
126
126
],
127
127
]]));
@@ -144,7 +144,7 @@ public function testCompleteWriteProcess()
144
144
]);
145
145
146
146
$ this ->assertSame ('POST ' , $ method );
147
- $ this ->assertSame ($ expectedBody , $ options ['body ' ]);
147
+ $ this ->assertJsonStringEqualsJsonString ($ expectedBody , $ options ['body ' ]);
148
148
149
149
return new MockResponse (json_encode (['keys ' => [
150
150
[
@@ -153,8 +153,8 @@ public function testCompleteWriteProcess()
153
153
],
154
154
]]));
155
155
};
156
-
157
- $ updateTranslationsResponse = function (string $ method , string $ url , array $ options = []): ResponseInterface {
156
+ $ updateProcessed = false ;
157
+ $ updateTranslationsResponse = function (string $ method , string $ url , array $ options = []) use (& $ updateProcessed ) : ResponseInterface {
158
158
$ expectedBody = json_encode ([
159
159
'keys ' => [
160
160
[
@@ -169,11 +169,11 @@ public function testCompleteWriteProcess()
169
169
'translations ' => [
170
170
[
171
171
'language_iso ' => 'en ' ,
172
- 'translation ' => 'trans_en_a ' ,
172
+ 'translation ' => 'puppy ' ,
173
173
],
174
174
[
175
175
'language_iso ' => 'fr ' ,
176
- 'translation ' => 'trans_fr_a ' ,
176
+ 'translation ' => 'chiot ' ,
177
177
],
178
178
],
179
179
],
@@ -200,8 +200,9 @@ public function testCompleteWriteProcess()
200
200
],
201
201
]);
202
202
203
+ $ updateProcessed = true ;
203
204
$ this ->assertSame ('PUT ' , $ method );
204
- $ this ->assertSame ($ expectedBody , $ options ['body ' ]);
205
+ $ this ->assertJsonStringEqualsJsonString ($ expectedBody , $ options ['body ' ]);
205
206
206
207
return new MockResponse ();
207
208
};
@@ -221,15 +222,16 @@ public function testCompleteWriteProcess()
221
222
222
223
$ translatorBag = new TranslatorBag ();
223
224
$ translatorBag ->addCatalogue (new MessageCatalogue ('en ' , [
224
- 'messages ' => ['a ' => 'trans_en_a ' ],
225
+ 'messages ' => ['young_dog ' => 'puppy ' ],
225
226
'validators ' => ['post.num_comments ' => '{count, plural, one {# comment} other {# comments}} ' ],
226
227
]));
227
228
$ translatorBag ->addCatalogue (new MessageCatalogue ('fr ' , [
228
- 'messages ' => ['a ' => 'trans_fr_a ' ],
229
+ 'messages ' => ['young_dog ' => 'chiot ' ],
229
230
'validators ' => ['post.num_comments ' => '{count, plural, one {# commentaire} other {# commentaires}} ' ],
230
231
]));
231
232
232
233
$ provider ->write ($ translatorBag );
234
+ $ this ->assertTrue ($ updateProcessed , 'Translations update was not called. ' );
233
235
}
234
236
235
237
/**
@@ -248,7 +250,7 @@ public function testReadForOneLocaleAndOneDomain(string $locale, string $domain,
248
250
249
251
$ this ->assertSame ('POST ' , $ method );
250
252
$ this ->assertSame ('https://api.lokalise.com/api2/projects/PROJECT_ID/files/export ' , $ url );
251
- $ this ->assertSame ($ expectedBody , $ options ['body ' ]);
253
+ $ this ->assertJsonStringEqualsJsonString ($ expectedBody , $ options ['body ' ]);
252
254
253
255
return new MockResponse (json_encode ([
254
256
'files ' => [
0 commit comments