public function BlockListElementsTest::testBlockListPage in Block permissions 8
Tests configuration elements on the block list page.
Page for testing - "/admin/structure/block".
File
- tests/
src/ Functional/ BlockListElementsTest.php, line 54
Class
- BlockListElementsTest
- Tests visibility of configuration elements on the block_admin_display_form.
Namespace
Drupal\Tests\block_permissions\FunctionalCode
public function testBlockListPage() {
$block_admin_display_path = Url::fromRoute('block.admin_display');
// Ensure user sees blocks but can administer block from core only.
$this
->drupalLogin($this->coreBlocksUser);
$this
->drupalGet($block_admin_display_path);
$this
->assertSession()
->pageTextContains($this->pageTitleBlock
->label());
$this
->assertSession()
->pageTextContains($this->systemBrandingBlock
->label());
$this
->assertBlockElementsExists($this->pageTitleBlock
->id());
$this
->assertBlockElementsNotExists($this->systemBrandingBlock
->id());
// Ensure user sees blocks but can administer block from system module only.
$this
->drupalLogin($this->systemBlocksUser);
$this
->drupalGet($block_admin_display_path);
$this
->assertSession()
->pageTextContains($this->pageTitleBlock
->label());
$this
->assertSession()
->pageTextContains($this->systemBrandingBlock
->label());
$this
->assertBlockElementsNotExists($this->pageTitleBlock
->id());
$this
->assertBlockElementsExists($this->systemBrandingBlock
->id());
}