public function ToolbarTest::testButton in Rebuild Cache Access 8
Tests that the toolbar button works.
File
- tests/
src/ Functional/ ToolbarTest.php, line 27
Class
- ToolbarTest
- Tests rebuild_cache_access toolbar functionality.
Namespace
Drupal\Tests\rebuild_cache_access\FunctionalCode
public function testButton() {
// First, a user without rebuild cache permission should not see the button.
$editor = $this
->drupalCreateUser([
'access toolbar',
]);
$this
->drupalLogin($editor);
$this
->drupalGet('');
$this
->assertSession()
->pageTextNotContains('Rebuild Cache');
// Second, a user with rebuild cache permission should see the button.
$developer = $this
->drupalCreateUser([
'access toolbar',
'rebuild cache access',
]);
$this
->drupalLogin($developer);
$this
->drupalGet('');
$this
->assertSession()
->pageTextContains('Rebuild Cache');
// Click the button.
$this
->clickLink('Rebuild Cache');
$this
->assertSession()
->pageTextContains('All caches cleared.');
}