From e2b46f13b446d52698a21162c90cbc7438968011 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Fri, 12 May 2017 09:48:34 +0100 Subject: [PATCH] Issue #2870451 by andypost, snetcher, michielnugter, dawehner: Convert web tests to browser tests for menu_link_content module --- .../tests/src/Functional/ContentTranslationUITestBase.php | 5 +++-- .../src/Functional}/MenuLinkContentDeleteFormTest.php | 6 +++--- .../src/Functional}/MenuLinkContentFormTest.php | 8 ++++---- .../src/Functional}/MenuLinkContentTranslationUITest.php | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) rename core/modules/menu_link_content/{src/Tests => tests/src/Functional}/MenuLinkContentDeleteFormTest.php (91%) rename core/modules/menu_link_content/{src/Tests => tests/src/Functional}/MenuLinkContentFormTest.php (91%) rename core/modules/menu_link_content/{src/Tests => tests/src/Functional}/MenuLinkContentTranslationUITest.php (96%) diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php index 370a6ed409e..e69329cb5fb 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\content_translation\Functional; +use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityChangedInterface; use Drupal\Core\Entity\EntityInterface; @@ -226,10 +227,10 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase { $language = new Language(['id' => $langcode]); $view_url = $entity->url('canonical', ['language' => $language]); $elements = $this->xpath('//table//a[@href=:href]', [':href' => $view_url]); - $this->assertEqual((string) $elements[0], $entity->getTranslation($langcode)->label(), format_string('Label correctly shown for %language translation.', ['%language' => $langcode])); + $this->assertEqual($elements[0]->getText(), $entity->getTranslation($langcode)->label(), new FormattableMarkup('Label correctly shown for %language translation.', ['%language' => $langcode])); $edit_path = $entity->url('edit-form', ['language' => $language]); $elements = $this->xpath('//table//ul[@class="dropbutton"]/li/a[@href=:href]', [':href' => $edit_path]); - $this->assertEqual((string) $elements[0], t('Edit'), format_string('Edit link correct for %language translation.', ['%language' => $langcode])); + $this->assertEqual($elements[0]->getText(), t('Edit'), new FormattableMarkup('Edit link correct for %language translation.', ['%language' => $langcode])); } } } diff --git a/core/modules/menu_link_content/src/Tests/MenuLinkContentDeleteFormTest.php b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php similarity index 91% rename from core/modules/menu_link_content/src/Tests/MenuLinkContentDeleteFormTest.php rename to core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php index e6ec76e5dee..cb1e10daf94 100644 --- a/core/modules/menu_link_content/src/Tests/MenuLinkContentDeleteFormTest.php +++ b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php @@ -1,17 +1,17 @@ drupalGet('admin/structure/menu/manage/admin/add'); $element = $this->xpath('//select[@id = :id]/option[@selected]', [':id' => 'edit-menu-parent']); $this->assertTrue($element, 'A default menu parent was found.'); - $this->assertEqual('admin:', $element[0]['value'], ' menu is the parent.'); + $this->assertEqual('admin:', $element[0]->getValue(), ' menu is the parent.'); $this->drupalPostForm( NULL, diff --git a/core/modules/menu_link_content/src/Tests/MenuLinkContentTranslationUITest.php b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php similarity index 96% rename from core/modules/menu_link_content/src/Tests/MenuLinkContentTranslationUITest.php rename to core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php index b0419563b04..a2ba9930fc1 100644 --- a/core/modules/menu_link_content/src/Tests/MenuLinkContentTranslationUITest.php +++ b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php @@ -1,8 +1,8 @@