function BlockContentUpdateTest::testBlockLibraryPermissionsUpdate
Same name in other branches
- 10 core/modules/block_content/tests/src/Functional/Update/BlockContentUpdateTest.php \Drupal\Tests\block_content\Functional\Update\BlockContentUpdateTest::testBlockLibraryPermissionsUpdate()
Tests the permissions are updated for users with "administer blocks".
See also
block_content_post_update_sort_permissions()
File
-
core/
modules/ block_content/ tests/ src/ Functional/ Update/ BlockContentUpdateTest.php, line 112
Class
- BlockContentUpdateTest
- Tests update functions for the Block Content module.
Namespace
Drupal\Tests\block_content\Functional\UpdateCode
public function testBlockLibraryPermissionsUpdate() : void {
$user = $this->drupalCreateUser([
'administer blocks',
]);
$this->assertTrue($user->hasPermission('administer blocks'));
$this->assertFalse($user->hasPermission('administer block content'));
$this->assertFalse($user->hasPermission('administer block types'));
$this->assertFalse($user->hasPermission('access block library'));
$this->runUpdates();
$user = User::load($user->id());
$this->assertTrue($user->hasPermission('administer blocks'));
$this->assertTrue($user->hasPermission('administer block content'));
$this->assertTrue($user->hasPermission('administer block types'));
$this->assertTrue($user->hasPermission('access block library'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.