function UserPermissionsTest::testBundlePermissionError
Same name in other branches
- 11.x core/modules/user/tests/src/Functional/UserPermissionsTest.php \Drupal\Tests\user\Functional\UserPermissionsTest::testBundlePermissionError()
Tests that access check does not trigger warnings.
The access check for /admin/structure/comment/manage/comment/permissions is \Drupal\user\Form\EntityPermissionsForm::EntityPermissionsForm::access().
File
-
core/
modules/ user/ tests/ src/ Functional/ UserPermissionsTest.php, line 309
Class
- UserPermissionsTest
- Verifies role permissions can be added and removed via the permissions page.
Namespace
Drupal\Tests\user\FunctionalCode
public function testBundlePermissionError() : void {
\Drupal::service('module_installer')->install([
'comment',
'dblog',
'field_ui',
'node',
]);
// Set up the node and comment field. Use the 'default' view mode since
// 'full' is not defined, so it will not be added to the config entity.
$this->drupalCreateContentType([
'type' => 'article',
]);
$this->addDefaultCommentField('node', 'article', comment_view_mode: 'default');
$this->drupalLogin($this->adminUser);
$this->grantPermissions(Role::load($this->rid), [
'access site reports',
'administer comment display',
]);
// Access both the Manage display and permission page, which is not
// accessible currently.
$assert_session = $this->assertSession();
$this->drupalGet('/admin/structure/comment/manage/comment/display');
$assert_session->statusCodeEquals(200);
$this->drupalGet('/admin/structure/comment/manage/comment/permissions');
$assert_session->statusCodeEquals(403);
// Ensure there are no warnings in the log.
$this->drupalGet('/admin/reports/dblog');
$assert_session->statusCodeEquals(200);
$assert_session->pageTextContains('access denied');
$assert_session->pageTextNotContains("Entity view display 'node.article.default': Component");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.