You are here

function ToolbarHookToolbarTest::testHookToolbar in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/toolbar/src/Tests/ToolbarHookToolbarTest.php \Drupal\toolbar\Tests\ToolbarHookToolbarTest::testHookToolbar()

Tests for a tab and tray provided by a module implementing hook_toolbar().

File

core/modules/toolbar/src/Tests/ToolbarHookToolbarTest.php, line 44
Contains \Drupal\toolbar\Tests\ToolbarHookToolbarTest.

Class

ToolbarHookToolbarTest
Tests the implementation of hook_toolbar() by a module.

Namespace

Drupal\toolbar\Tests

Code

function testHookToolbar() {
  $this
    ->drupalGet('test-page');
  $this
    ->assertResponse(200);

  // Assert that the toolbar is present in the HTML.
  $this
    ->assertRaw('id="toolbar-administration"');

  // Assert that the tab registered by toolbar_test is present.
  $this
    ->assertRaw('id="toolbar-tab-testing"');

  // Assert that the tab item descriptions are present.
  $this
    ->assertRaw('title="Test tab"');

  // Assert that the tray registered by toolbar_test is present.
  $this
    ->assertRaw('id="toolbar-tray-testing"');

  // Assert that tray item descriptions are present.
  $this
    ->assertRaw('title="Test link 1 title"');
}