diff --git a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php index b0a4b5f28e..9187bf0c0d 100644 --- a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationImportTest.php @@ -206,7 +206,7 @@ public function testLocaleRemovalAndConfigOverridePreserve() { $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); $textareas = $this->xpath('//textarea'); $textarea = current($textareas); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => '', ]; diff --git a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php index 701ef585f2..cfef00852f 100644 --- a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php @@ -76,7 +76,7 @@ public function testConfigTranslation() { $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); $textareas = $this->xpath('//textarea'); $textarea = current($textareas); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => $message, ]; @@ -100,7 +100,7 @@ public function testConfigTranslation() { $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); $textareas = $this->xpath('//textarea'); $textarea = current($textareas); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => 'D', ]; @@ -143,7 +143,7 @@ public function testConfigTranslation() { ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => $image_style_label, ]; @@ -175,7 +175,7 @@ public function testConfigTranslation() { ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => $category_label, ]; diff --git a/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php b/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php index 1d5b00548c..5b146b4cba 100644 --- a/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.php @@ -21,7 +21,7 @@ class LocaleJavascriptTranslationTest extends BrowserTestBase { public static $modules = ['locale', 'locale_test']; public function testFileParsing() { - $filename = __DIR__ . '/../../tests/locale_test.js'; + $filename = __DIR__ . '/../../locale_test.js'; // Parse the file to look for source strings. _locale_parse_js_file($filename); @@ -138,8 +138,9 @@ public function testLocaleTranslationJsDependencies() { $js_translation_files = \Drupal::state()->get('locale.translation.javascript'); $js_filename = $prefix . '_' . $js_translation_files[$prefix] . '.js'; + $content = $this->getSession()->getPage()->getcontent(); // Assert translations JS is included before drupal.js. - $this->assertTrue(strpos($this->content, $js_filename) < strpos($this->content, 'core/misc/drupal.js'), 'Translations are included before Drupal.t.'); + $this->assertTrue(strpos($content, $js_filename) < strpos($content, 'core/misc/drupal.js'), 'Translations are included before Drupal.t.'); } } diff --git a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php index 90603282ed..c21410f2bc 100644 --- a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php @@ -89,7 +89,7 @@ public function testStringTranslation() { // Assume this is the only result, given the random name. $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => $translation, ]; @@ -112,7 +112,7 @@ public function testStringTranslation() { ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => $translation_to_en, ]; @@ -155,7 +155,7 @@ public function testStringTranslation() { ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => 'Please enter your Llama username.', ]; @@ -189,7 +189,7 @@ public function testStringTranslation() { $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); // Assume this is the only result, given the random name. $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => '', ]; @@ -248,7 +248,7 @@ public function testJavaScriptTranslation() { $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => $this->randomMachineName(), ]; @@ -309,15 +309,15 @@ public function testStringValidation() { // Find the edit path. $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); foreach ($bad_translations as $translation) { $edit = [ $lid => $translation, ]; $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations')); // Check for a form error on the textarea. - $form_class = $this->xpath('//form[@id="locale-translate-edit-form"]//textarea/@class'); - $this->assertNotIdentical(FALSE, strpos($form_class[0], 'error'), 'The string was rejected as unsafe.'); + $form_class = $this->xpath('//form[@id="locale-translate-edit-form"]//textarea'); + $this->assertNotIdentical(FALSE, strpos($form_class->getAttribute('class'), 'error'), 'The string was rejected as unsafe.'); $this->assertNoText(t('The string has been saved.'), 'The string was not saved.'); } } @@ -399,7 +399,7 @@ public function testStringSearch() { // Assume this is the only result, given the random name. // We save the lid from the path. $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => $translation, ]; @@ -503,7 +503,7 @@ public function testUICustomizedStrings() { // Submit the translations without changing the translation. $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => $translation->getString(), ]; @@ -522,7 +522,7 @@ public function testUICustomizedStrings() { // Submit the translations with a new translation. $textarea = current($this->xpath('//textarea')); - $lid = (string) $textarea[0]['name']; + $lid = (string) $textarea->getAttribute('name'); $edit = [ $lid => $this->randomMachineName(100), ]; diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php index b24ce78b96..d0d5379139 100644 --- a/core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\locale\Functional; +use Drupal\Tests\Traits\Core\CronRunTrait; + /** * Tests for using cron to update project interface translations. * @@ -9,6 +11,8 @@ */ class LocaleUpdateCronTest extends LocaleUpdateBase { + use CronRunTrait; + protected $batchOutput = []; /**