comparison core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
2 2
3 namespace Drupal\Tests\locale\Functional; 3 namespace Drupal\Tests\locale\Functional;
4 4
5 use Drupal\Core\Language\LanguageInterface; 5 use Drupal\Core\Language\LanguageInterface;
6 use Drupal\Tests\BrowserTestBase; 6 use Drupal\Tests\BrowserTestBase;
7 use Drupal\Component\Utility\SafeMarkup; 7 use Drupal\Component\Render\FormattableMarkup;
8 8
9 /** 9 /**
10 * Tests parsing js files for translatable strings. 10 * Tests parsing js files for translatable strings.
11 * 11 *
12 * @group locale 12 * @group locale
90 // Assert that all strings were found properly. 90 // Assert that all strings were found properly.
91 foreach ($test_strings as $str => $context) { 91 foreach ($test_strings as $str => $context) {
92 $args = ['%source' => $str, '%context' => $context]; 92 $args = ['%source' => $str, '%context' => $context];
93 93
94 // Make sure that the string was found in the file. 94 // Make sure that the string was found in the file.
95 $this->assertTrue(isset($source_strings[$str]), SafeMarkup::format('Found source string: %source', $args)); 95 $this->assertTrue(isset($source_strings[$str]), new FormattableMarkup('Found source string: %source', $args));
96 96
97 // Make sure that the proper context was matched. 97 // Make sure that the proper context was matched.
98 $message = $context ? SafeMarkup::format('Context for %source is %context', $args) : SafeMarkup::format('Context for %source is blank', $args); 98 $message = $context ? new FormattableMarkup('Context for %source is %context', $args) : new FormattableMarkup('Context for %source is blank', $args);
99 $this->assertTrue(isset($source_strings[$str]) && $source_strings[$str] === $context, $message); 99 $this->assertTrue(isset($source_strings[$str]) && $source_strings[$str] === $context, $message);
100 } 100 }
101 101
102 $this->assertEqual(count($source_strings), count($test_strings), 'Found correct number of source strings.'); 102 $this->assertEqual(count($source_strings), count($test_strings), 'Found correct number of source strings.');
103 } 103 }