Commit 477fbfd2 authored by catch's avatar catch

Issue #2863597 by Lendude, Jo Fitzgerald, michielnugter, nlisgo, dawehner:...

Issue #2863597 by Lendude, Jo Fitzgerald, michielnugter, nlisgo, dawehner: Convert web tests to browser tests for toolbar module
parent 9e7f7cd4
<?php
namespace Drupal\toolbar\Tests;
namespace Drupal\Tests\toolbar\Functional;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
use Drupal\user\RoleInterface;
/**
......@@ -25,7 +26,7 @@
*
* @group toolbar
*/
class ToolbarAdminMenuTest extends WebTestBase {
class ToolbarAdminMenuTest extends BrowserTestBase {
/**
* A user with permission to access the administrative toolbar.
......@@ -297,7 +298,7 @@ public function testLocaleTranslationSubtreesHashCacheClear() {
// Assume this is the only result.
// Translate the string to a random string.
$textarea = current($this->xpath('//textarea'));
$lid = (string) $textarea[0]['name'];
$lid = (string) $textarea->getAttribute('name');
$edit = [
$lid => $translation,
];
......@@ -330,8 +331,8 @@ public function testSubtreesJsonRequest() {
// Request a new page to refresh the drupalSettings object.
$subtrees_hash = $this->getSubtreesHash();
$ajax_result = $this->drupalGetAjax('toolbar/subtrees/' . $subtrees_hash);
$this->assertResponse('200');
$this->drupalGet('toolbar/subtrees/' . $subtrees_hash, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']], ['X-Requested-With: XMLHttpRequest']);
$ajax_result = json_decode($this->getSession()->getPage()->getContent(), TRUE);
$this->assertEqual($ajax_result[0]['command'], 'setToolbarSubtrees', 'Subtrees response uses the correct command.');
$this->assertEqual(array_keys($ajax_result[0]['subtrees']), ['system-admin_content', 'system-admin_structure', 'system-themes_page', 'system-modules_list', 'system-admin_config', 'entity-user-collection', 'front'], 'Correct subtrees returned.');
}
......
<?php
namespace Drupal\toolbar\Tests;
namespace Drupal\Tests\toolbar\Functional;
use Drupal\Core\Cache\Cache;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\simpletest\WebTestBase;
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -13,7 +13,7 @@
*
* @group toolbar
*/
class ToolbarCacheContextsTest extends WebTestBase {
class ToolbarCacheContextsTest extends BrowserTestBase {
use AssertPageCacheContextsAndTagsTrait;
......
<?php
namespace Drupal\toolbar\Tests;
namespace Drupal\Tests\toolbar\Functional;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Tests that the toolbar icon class remains for translated menu items.
*
* @group toolbar
*/
class ToolbarMenuTranslationTest extends WebTestBase {
class ToolbarMenuTranslationTest extends BrowserTestBase {
/**
* A user with permission to access the administrative toolbar.
......@@ -66,7 +66,7 @@ public function testToolbarClasses() {
// Translate the menu item.
$menu_item_translated = $this->randomMachineName();
$textarea = current($this->xpath('//textarea'));
$lid = (string) $textarea[0]['name'];
$lid = (string) $textarea->getAttribute('name');
$edit = [
$lid => $menu_item_translated,
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment