Commit bee65c1c authored by eme's avatar eme

Refactor basic tests.

parent 48e5a8c0
<?php
/**
* @file
* Contains \Drupal\admin_toolbar\Tests\AdminToolbarAlterTest.
*/
namespace Drupal\admin_toolbar_tools\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Test the existence of Admin Toolbar tools new links.
*
* @group admin_toolbar_tools
*/
class AdminToolbarToolsAlterTest extends WebTestBase {
/**
* A user with permission to access the administrative toolbar.
*
* @var \Drupal\user\UserInterface
*/
protected $adminUser;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('toolbar', 'admin_toolbar', 'admin_toolbar_tools');
protected function setUp() {
parent::setUp();
// Create an administrative user and log it in.
$this->adminUser = $this->drupalCreateUser(array('access toolbar', 'access administration pages'));
$this->drupalLogin($this->adminUser);
}
/**
* Tests for a the hover of sub menus.
*/
function testAdminToolbarTools() {
// Test for admin_toolbar_tools if special menu items are added.
$this->assertRaw('id="toolbar-link-admin_toolbar_tools-flush"');
}
}
......@@ -34,7 +34,7 @@ class AdminToolbarAlterTest extends WebTestBase {
parent::setUp();
// Create an administrative user and log it in.
$this->adminUser = $this->drupalCreateUser(array('access toolbar'));
$this->adminUser = $this->drupalCreateUser(array('access toolbar', 'administer modules', 'access administration pages'));
$this->drupalLogin($this->adminUser);
}
......@@ -42,17 +42,11 @@ class AdminToolbarAlterTest extends WebTestBase {
* Tests for a the hover of sub menus.
*/
function testAdminToolbar() {
// Get the front page.
$this->drupalGet('<front>');
$this->assertResponse(200);
// Assert that expanded links are present in HTML.
// Test with the uninstall link that must be there whatever modules exists.
$this->assertRaw('id="toolbar-link-system-modules_uninstall"');
// Test for admin_toolbar_tools if special menu items are added.
$this->assertRaw('id="toolbar-link-admin_toolbar_tools-flush"');
}
}
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