public function UserPermissionsTest::testAccessContentPermission in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Functional/UserPermissionsTest.php \Drupal\Tests\user\Functional\UserPermissionsTest::testAccessContentPermission()
- 10 core/modules/user/tests/src/Functional/UserPermissionsTest.php \Drupal\Tests\user\Functional\UserPermissionsTest::testAccessContentPermission()
Verify 'access content' is listed in the correct location.
File
- core/
modules/ user/ tests/ src/ Functional/ UserPermissionsTest.php, line 186
Class
- UserPermissionsTest
- Verify that role permissions can be added and removed via the permissions page.
Namespace
Drupal\Tests\user\FunctionalCode
public function testAccessContentPermission() {
$this
->drupalLogin($this->adminUser);
// When Node is not installed the 'access content' permission is listed next
// to 'access site reports'.
$this
->drupalGet('admin/people/permissions');
$next_row = $this
->xpath('//tr[@data-drupal-selector=\'edit-permissions-access-content\']/following-sibling::tr[1]');
$this
->assertEquals('edit-permissions-access-site-reports', $next_row[0]
->getAttribute('data-drupal-selector'));
// When Node is installed the 'access content' permission is listed next to
// to 'view own unpublished content'.
\Drupal::service('module_installer')
->install([
'node',
]);
$this
->drupalGet('admin/people/permissions');
$next_row = $this
->xpath('//tr[@data-drupal-selector=\'edit-permissions-access-content\']/following-sibling::tr[1]');
$this
->assertEquals('edit-permissions-view-own-unpublished-content', $next_row[0]
->getAttribute('data-drupal-selector'));
}