public function CoffeeTest::testCoffeeToolbarIntegration in Coffee 8
Tests that the toolbar integration works properly.
File
- tests/
src/ Functional/ CoffeeTest.php, line 145
Class
- CoffeeTest
- Tests Coffee module functionality.
Namespace
Drupal\Tests\coffee\FunctionalCode
public function testCoffeeToolbarIntegration() {
\Drupal::service('module_installer')
->install([
'toolbar',
]);
$tab_xpath = '//nav[@id="toolbar-bar"]//div/a[contains(@class, "toolbar-icon-coffee")]';
$toolbar_user = $this
->drupalCreateUser([
'access toolbar',
]);
$this
->drupalLogin($toolbar_user);
$this
->assertSession()
->responseContains('id="toolbar-administration"');
$this
->assertSession()
->elementNotExists('xpath', $tab_xpath);
$coffee_toolbar_user = $this
->drupalCreateUser([
'access toolbar',
'access coffee',
]);
$this
->drupalLogin($coffee_toolbar_user);
$this
->assertSession()
->responseContains('id="toolbar-administration"');
$this
->assertSession()
->elementExists('xpath', $tab_xpath);
}