Issue #2870451 by andypost, snetcher, michielnugter, dawehner: Convert web tests to browser tests for menu_link_content module

8.4.x
Alex Pott 2017-05-12 09:48:34 +01:00
parent 0493d9fbd9
commit e2b46f13b4
4 changed files with 12 additions and 11 deletions

View File

@ -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]));
}
}
}

View File

@ -1,17 +1,17 @@
<?php
namespace Drupal\menu_link_content\Tests;
namespace Drupal\Tests\menu_link_content\Functional;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\simpletest\WebTestBase;
use Drupal\system\Entity\Menu;
use Drupal\Tests\BrowserTestBase;
/**
* Tests the menu link content delete UI.
*
* @group Menu
*/
class MenuLinkContentDeleteFormTest extends WebTestBase {
class MenuLinkContentDeleteFormTest extends BrowserTestBase {
/**
* Modules to enable.

View File

@ -1,16 +1,16 @@
<?php
namespace Drupal\menu_link_content\Tests;
namespace Drupal\Tests\menu_link_content\Functional;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Tests the menu link content UI.
*
* @group Menu
*/
class MenuLinkContentFormTest extends WebTestBase {
class MenuLinkContentFormTest extends BrowserTestBase {
/**
* Modules to enable.
@ -77,7 +77,7 @@ class MenuLinkContentFormTest extends WebTestBase {
$this->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'], '<Administration> menu is the parent.');
$this->assertEqual('admin:', $element[0]->getValue(), '<Administration> menu is the parent.');
$this->drupalPostForm(
NULL,

View File

@ -1,8 +1,8 @@
<?php
namespace Drupal\menu_link_content\Tests;
namespace Drupal\Tests\menu_link_content\Functional;
use Drupal\content_translation\Tests\ContentTranslationUITestBase;
use Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase;
use Drupal\menu_link_content\Entity\MenuLinkContent;
/**