You are here

public function DevelToolbarTest::testToolbarModuleNotInstalled in Devel 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/DevelToolbarTest.php \Drupal\Tests\devel\Functional\DevelToolbarTest::testToolbarModuleNotInstalled()
  2. 8 tests/src/Functional/DevelToolbarTest.php \Drupal\Tests\devel\Functional\DevelToolbarTest::testToolbarModuleNotInstalled()
  3. 4.x tests/src/Functional/DevelToolbarTest.php \Drupal\Tests\devel\Functional\DevelToolbarTest::testToolbarModuleNotInstalled()

Tests devel when toolbar module is not installed.

File

tests/src/Functional/DevelToolbarTest.php, line 223

Class

DevelToolbarTest
Tests devel toolbar module functionality.

Namespace

Drupal\Tests\devel\Functional

Code

public function testToolbarModuleNotInstalled() {

  // Ensures that when toolbar module is not installed all works properly.
  \Drupal::service('module_installer')
    ->uninstall([
    'toolbar',
  ]);
  $this
    ->drupalLogin($this->develUser);

  // Toolbar settings page should respond with 404.
  $this
    ->drupalGet('admin/config/development/devel/toolbar');
  $this
    ->assertSession()
    ->statusCodeEquals(404);

  // Primary local task should not contains toolbar tab.
  $this
    ->drupalGet('admin/config/development/devel');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->elementNotExists('css', '.tabs .primary a:contains("Toolbar Settings")');

  // Toolbar setting config and devel menu cache tags sholud not present.
  $this
    ->drupalGet('');
  $this
    ->assertSession()
    ->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:devel.toolbar.settings');
  $this
    ->assertSession()
    ->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:system.menu.devel');
}