comparison core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children 12f9dff5fda9
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
3 namespace Drupal\Tests\locale\Functional; 3 namespace Drupal\Tests\locale\Functional;
4 4
5 use Drupal\language\Entity\ConfigurableLanguage; 5 use Drupal\language\Entity\ConfigurableLanguage;
6 use Drupal\Tests\BrowserTestBase; 6 use Drupal\Tests\BrowserTestBase;
7 use Drupal\Core\Language\LanguageInterface; 7 use Drupal\Core\Language\LanguageInterface;
8 use Drupal\Component\Utility\SafeMarkup; 8 use Drupal\Component\Render\FormattableMarkup;
9 9
10 /** 10 /**
11 * Adds a new locale and translates its name. Checks the validation of 11 * Adds a new locale and translates its name. Checks the validation of
12 * translation strings and search results. 12 * translation strings and search results.
13 * 13 *
257 // Trigger JavaScript translation parsing and building. 257 // Trigger JavaScript translation parsing and building.
258 _locale_rebuild_js($langcode); 258 _locale_rebuild_js($langcode);
259 259
260 $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: []; 260 $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: [];
261 $js_file = 'public://' . $config->get('javascript.directory') . '/' . $langcode . '_' . $locale_javascripts[$langcode] . '.js'; 261 $js_file = 'public://' . $config->get('javascript.directory') . '/' . $langcode . '_' . $locale_javascripts[$langcode] . '.js';
262 $this->assertTrue($result = file_exists($js_file), SafeMarkup::format('JavaScript file created: %file', ['%file' => $result ? $js_file : 'not found'])); 262 $this->assertTrue($result = file_exists($js_file), new FormattableMarkup('JavaScript file created: %file', ['%file' => $result ? $js_file : 'not found']));
263 263
264 // Test JavaScript translation rebuilding. 264 // Test JavaScript translation rebuilding.
265 file_unmanaged_delete($js_file); 265 file_unmanaged_delete($js_file);
266 $this->assertTrue($result = !file_exists($js_file), SafeMarkup::format('JavaScript file deleted: %file', ['%file' => $result ? $js_file : 'found'])); 266 $this->assertTrue($result = !file_exists($js_file), new FormattableMarkup('JavaScript file deleted: %file', ['%file' => $result ? $js_file : 'found']));
267 _locale_rebuild_js($langcode); 267 _locale_rebuild_js($langcode);
268 $this->assertTrue($result = file_exists($js_file), SafeMarkup::format('JavaScript file rebuilt: %file', ['%file' => $result ? $js_file : 'not found'])); 268 $this->assertTrue($result = file_exists($js_file), new FormattableMarkup('JavaScript file rebuilt: %file', ['%file' => $result ? $js_file : 'not found']));
269 } 269 }
270 270
271 /** 271 /**
272 * Tests the validation of the translation input. 272 * Tests the validation of the translation input.
273 */ 273 */