diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php index 932b111..9ad0439 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleJavascriptTranslation.php @@ -99,15 +99,14 @@ function testFileParsing() { $this->assertTrue(isset($source_strings[$str]), format_string("Found source string: %source", $args)); // Make sure that the proper context was matched. - $message = strlen($context) > 0 ? 'Context for %source is %context' : 'Context for %source is blank'; - if (isset($source_strings[$str]) && $source_strings[$str] === $context) { - $this->pass(format_string($message, $args)); + $test = isset($source_strings[$str]) && $source_strings[$str] === $context; + if (strlen($context) > 0) { + $this->assertTrue($test, format_string('Context for %source is %context', $args)); } else { - $this->fail(format_string($message, $args)); + $this->assertTrue($test, format_string('Context for %source is blank', $args)); } } - $this->assertEqual(count($source_strings), count($test_strings), "Found correct number of source strings."); } } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php index 8732590..caccc54 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePluralFormatTest.php @@ -121,24 +121,12 @@ function testGetPluralFormat() { foreach ($plural_tests as $langcode => $tests) { foreach ($tests as $count => $expected_plural_index) { // Assert that the we get the right plural index. - $this->assertIdentical(locale_get_plural($count, $langcode), $expected_plural_index, - format_string('Computed plural index for %langcode for count %count is %expected', array( - '%langcode' => $langcode, - '%count' => $count, - '%expected' => $expected_plural_index - )) - ); + $this->assertIdentical(locale_get_plural($count, $langcode), $expected_plural_index, 'Computed plural index for ' . $langcode . ' for count ' . $count . ' is ' . $expected_plural_index); // Assert that the we get the right translation for that. Change the // expected index as per the logic for translation lookups. $expected_plural_index = ($count == 1) ? 0 : $expected_plural_index; $expected_plural_string = str_replace('@count', $count, $plural_strings[$langcode][$expected_plural_index]); - $this->assertIdentical(format_plural($count, '1 hour', '@count hours', array(), array('langcode' => $langcode)), $expected_plural_string, - format_string('Plural translation of 1 hours / @count hours for count %count in %langcode is %expected', array( - '%count' => $count, - '%langcode' => $langcode, - '%expected' => $expected_plural_string - )) - ); + $this->assertIdentical(format_plural($count, '1 hour', '@count hours', array(), array('langcode' => $langcode)), $expected_plural_string, 'Plural translation of 1 hours / @count hours for count ' . $count . ' in ' . $langcode . ' is ' . $expected_plural_string); } } } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php index 4945a08..d9e05e7 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php @@ -89,7 +89,7 @@ function testUninstallProcess() { $config = config('locale.settings'); $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array(); $js_file = 'public://' . $config->get('javascript.directory') . '/fr_' . $locale_javascripts['fr'] . '.js'; - $this->assertTrue($result = file_exists($js_file), format_string('JavaScript file created: %file', array('%file' => $result ? $js_file : 'none'))); + $this->assertTrue(file_exists($js_file), format_string('JavaScript file created: %file', array('%file' => $js_file))); // Disable string caching. $config->set('cache_strings', 0)->save(); @@ -118,7 +118,7 @@ function testUninstallProcess() { $this->assertEqual(language(Language::TYPE_INTERFACE)->langcode, 'en', format_string('Language after uninstall: %lang', array('%lang' => language(Language::TYPE_INTERFACE)->langcode))); // Check JavaScript files deletion. - $this->assertTrue($result = !file_exists($js_file), format_string('JavaScript file deleted: %file', array('%file' => $result ? $js_file : 'found'))); + $this->assertFalse(file_exists($js_file), format_string('JavaScript file deleted: %file', array('%file' => $js_file))); // Check language count. $language_count = variable_get('language_count', 1);