public function FieldAccessTest::testStatusAccess in User protect 8
Tests field access for the user's status.
File
- tests/
src/ Kernel/ FieldAccessTest.php, line 81
Class
- FieldAccessTest
- Tests field access for each UserProtection plugin that protects a field.
Namespace
Drupal\Tests\userprotect\KernelCode
public function testStatusAccess() {
// Create an account with no protection. The logged in user should have the
// privileges to edit this account's status.
$account = $this
->drupalCreateUser();
$this
->assertTrue($account->status
->access('edit', $this->userAdmin), 'User admin can edit status of non-protected user.');
// Create a protected account. The logged in user should NOT have the
// privileges to edit this account's status.
$protected_account = $this
->createProtectedUser([
'user_status',
]);
$this
->assertFalse($protected_account->status
->access('edit', $this->userAdmin), 'User admin cannot edit status of protected user.');
}