@@ -256,9 +256,12 @@ public function testPersistentTranslations()
256
256
$ this ->assertEquals ($ expected , $ actual );
257
257
}
258
258
259
- public function testAlsoAddPersistentTranslations ()
259
+ public function testAddingPersistentStringsToExport ()
260
260
{
261
- $ this ->app ['config ' ]->set ('laravel-translatable-string-exporter.add-persistent-strings ' , true );
261
+ $ this ->app ['config ' ]->set (
262
+ 'laravel-translatable-string-exporter.add-persistent-strings-to-translations ' ,
263
+ true
264
+ );
262
265
263
266
$ this ->cleanLangsFolder ();
264
267
@@ -274,12 +277,13 @@ public function testAlsoAddPersistentTranslations()
274
277
275
278
$ this ->writeToTranslationFile ('es ' , $ content );
276
279
277
- // 2. Create a file with the keys of any strings which should persist and added to export file even if they are not contained in the views.
280
+ // 2. Create a file with the keys of any strings which should persist
281
+ // even if they are not contained in the views.
278
282
279
283
$ persistentContent = json_encode (['name3_en ' , 'name5_en ' ]);
280
284
$ this ->writeToTranslationFile (Exporter::PERSISTENT_STRINGS_FILENAME_WO_EXT , $ persistentContent );
281
285
282
- // 3. Create a test view only containing a new string and a string that also in persistent.
286
+ // 3. Create a test view only containing a new string and a string that is also in persistent strings .
283
287
284
288
$ this ->createTestView ("{{ __('name1_en') . __('name2_en') . __('name3_en') . __('name4_en') }} " );
285
289
@@ -289,17 +293,13 @@ public function testAlsoAddPersistentTranslations()
289
293
290
294
$ actual = $ this ->getTranslationFileContent ('es ' );
291
295
292
- // The new and persistent, strings should be added. The rest should remain.
296
+ // The new and persistent strings should be added. The rest should remain.
293
297
294
- $ expected = [
295
- 'name1_en ' => 'name1_es ' ,
296
- 'name2_en ' => 'name2_es ' ,
297
- 'name3_en ' => 'name3_es ' ,
298
+ $ expected = array_merge ($ existing_translations , [
298
299
'name4_en ' => 'name4_en ' ,
299
300
'name5_en ' => 'name5_en ' ,
300
- ];
301
+ ]) ;
301
302
302
303
$ this ->assertEquals ($ expected , $ actual );
303
-
304
304
}
305
305
}
0 commit comments