function DevelToolbarTest::testToolbarModuleNotInstalled

Same name in other branches
  1. 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 220

Class

DevelToolbarTest
Tests devel toolbar module functionality.

Namespace

Drupal\Tests\devel\Functional

Code

public function testToolbarModuleNotInstalled() : void {
    // 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 contain toolbar tab.
    $this->drupalGet('admin/config/development/devel');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertSession()
        ->elementNotExists('xpath', '//a[contains(text(), "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');
}