Issue #2735199 by klausi, naveenvalecha, dawehner, jhodgdon: Convert web tests to browser tests for help module

8.2.x
Alex Pott 2016-06-17 12:21:08 +01:00
parent b7a290160d
commit a142151dc6
5 changed files with 28 additions and 15 deletions

View File

@ -1,15 +1,15 @@
<?php
namespace Drupal\help\Tests;
namespace Drupal\Tests\help\Functional;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Verifies help for experimental modules.
*
* @group help
*/
class ExperimentalHelpTest extends WebTestBase {
class ExperimentalHelpTest extends BrowserTestBase {
/**
* Modules to enable.

View File

@ -1,15 +1,15 @@
<?php
namespace Drupal\help\Tests;
namespace Drupal\Tests\help\Functional;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Tests display of help block.
*
* @group help
*/
class HelpBlockTest extends WebTestBase {
class HelpBlockTest extends BrowserTestBase {
/**
* {@inheritdoc}

View File

@ -1,15 +1,15 @@
<?php
namespace Drupal\help\Tests;
namespace Drupal\Tests\help\Functional;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Verify help display and user access to help based on permissions.
*
* @group help
*/
class HelpTest extends WebTestBase {
class HelpTest extends BrowserTestBase {
/**
* Modules to enable.
@ -40,8 +40,6 @@ class HelpTest extends WebTestBase {
protected function setUp() {
parent::setUp();
$this->getModuleList();
// Create users.
$this->adminUser = $this->drupalCreateUser(array('access administration pages', 'view the administration theme', 'administer permissions'));
$this->anyUser = $this->drupalCreateUser(array());
@ -122,7 +120,7 @@ class HelpTest extends WebTestBase {
$this->assertResponse($response);
if ($response == 200) {
$this->assertTitle($name . ' | Drupal', format_string('%module title was displayed', array('%module' => $module)));
$this->assertEqual($this->cssSelect('h1.page-title')[0], t($name), format_string('%module heading was displayed', array('%module' => $module)));
$this->assertEquals($name, $this->cssSelect('h1.page-title')[0]->getText(), "$module heading was displayed");
$admin_tasks = system_get_module_admin_tasks($module, system_get_info('module', $module));
if (!empty($admin_tasks)) {
$this->assertText(t('@module administration pages', array('@module' => $name)));

View File

@ -1,15 +1,15 @@
<?php
namespace Drupal\help\Tests;
namespace Drupal\Tests\help\Functional;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Verify no help is displayed for modules not providing any help.
*
* @group help
*/
class NoHelpTest extends WebTestBase {
class NoHelpTest extends BrowserTestBase {
/**
* Modules to enable.

View File

@ -229,4 +229,19 @@ trait AssertLegacyTrait {
$this->assertSession()->addressEquals($path);
}
/**
* Passes if the raw text IS NOT found escaped on the loaded page.
*
* Raw text refers to the raw HTML that the page generated.
*
* @param string $raw
* Raw (HTML) string to look for.
*
* @deprecated Scheduled for removal in Drupal 9.0.0.
* Use $this->assertSession()->assertNoEscaped() instead.
*/
public function assertNoEscaped($raw) {
$this->assertSession()->assertNoEscaped($raw);
}
}