public function BlockGroupTest::testBlockGroupUserAccess in Block Group 8
Creates a block group and verifies its consistency.
Throws
\Behat\Mink\Exception\ExpectationException
File
- tests/
src/ Functional/ BlockGroupTest.php, line 35
Class
- BlockGroupTest
- Tests the access of block groups and CRUD.
Namespace
Drupal\Tests\blockgroup\FunctionalCode
public function testBlockGroupUserAccess() {
// Anonymous users can't access the page.
$this
->drupalGet('admin/structure/block_group_content');
$this
->assertSession()
->statusCodeEquals(403);
// Authenticated users without the "administer blocks" permission can't
// access the page.
$web_user1 = $this
->drupalCreateUser();
$this
->drupalLogin($web_user1);
$this
->drupalGet('admin/structure/block_group_content');
$this
->assertSession()
->statusCodeEquals(403);
// Authenticated users with "administer blocks" permission can access the
// page.
$web_user2 = $this
->drupalCreateUser([
'administer blockgroups',
]);
$this
->drupalLogin($web_user2);
$this
->drupalGet('admin/structure/block_group_content');
$this
->assertSession()
->statusCodeEquals(200);
}