public function BlockListsRoutesAccessTest::testBlockThemeListAccess in Block permissions 8
Test the access to the "/admin/structure/block/list/{theme}" page.
@covers ::blockThemeListAccess
File
- tests/
src/ Functional/ BlockListsRoutesAccessTest.php, line 72
Class
- BlockListsRoutesAccessTest
- Tests Block permissions access control handler for block list pages.
Namespace
Drupal\Tests\block_permissions\FunctionalCode
public function testBlockThemeListAccess() {
// Ensure the user has the access to the list of blocks of the default theme
// only.
$this
->drupalLogin($this->defaultThemeUser);
$this
->drupalGet($this
->getBlockAdminDisplayThemeUrl($this->defaultTheme));
$this
->assertBlockListPageHasAccess();
$this
->drupalGet($this
->getBlockAdminDisplayThemeUrl($this->secondTheme));
$this
->assertSession()
->statusCodeEquals(403);
// Ensure the user has the access to the list of blocks of the second theme
// only.
$this
->drupalLogin($this->secondThemeUser);
$this
->drupalGet($this
->getBlockAdminDisplayThemeUrl($this->defaultTheme));
$this
->assertSession()
->statusCodeEquals(403);
$this
->drupalGet($this
->getBlockAdminDisplayThemeUrl($this->secondTheme));
$this
->assertBlockListPageHasAccess();
}