public function InstallTest::testInstallationWithAdminToolbar in Login Destination 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/InstallTest.php \Drupal\Tests\login_destination\Functional\InstallTest::testInstallationWithAdminToolbar()
Tests that the module is installable with admin_toolbar_tools.
File
- tests/
src/ Functional/ InstallTest.php, line 53
Class
- InstallTest
- Tests module installation.
Namespace
Drupal\Tests\login_destination\FunctionalCode
public function testInstallationWithAdminToolbar() {
$this
->assertFalse($this->moduleHandler
->moduleExists('admin_toolbar'));
$this
->assertFalse($this->moduleHandler
->moduleExists('admin_toolbar_tools'));
$this
->assertFalse($this->moduleHandler
->moduleExists('login_destination'));
$this
->assertTrue($this->moduleInstaller
->install([
'admin_toolbar',
'admin_toolbar_tools',
'login_destination',
]));
// Workaround https://www.drupal.org/node/2021959
// See \Drupal\Core\Test\FunctionalTestSetupTrait::rebuildContainer.
unset($this->moduleHandler);
$this
->rebuildContainer();
$this->moduleHandler = $this->container
->get('module_handler');
// Ensure that all specified modules were installed.
$this
->assertTrue($this->moduleHandler
->moduleExists('admin_toolbar'));
$this
->assertTrue($this->moduleHandler
->moduleExists('admin_toolbar_tools'));
$this
->assertTrue($this->moduleHandler
->moduleExists('login_destination'));
// Login as admin and ensure that there are no errors.
$admin = $this
->drupalCreateUser([
'access toolbar',
'access administration pages',
]);
$this
->drupalLogin($admin);
// Assert that expanded links are present in the HTML.
$this
->assertRaw('class="toolbar-icon toolbar-icon-user-admin-index"');
}