You are here

public function PermissionModeTest::testHandleNodeAsAdmin in Permissions by Term 8.2

File

tests/src/Kernel/PermissionModeTest.php, line 60

Class

PermissionModeTest
Class AccessCheckTest

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

public function testHandleNodeAsAdmin() : void {
  $this
    ->createRelationWithoutRestriction();
  $node = Node::load($this
    ->getNidNoRestriction());
  \Drupal::configFactory()
    ->getEditable('permissions_by_term.settings')
    ->set('permission_mode', TRUE)
    ->save();
  \Drupal::service('current_user')
    ->setAccount(User::load(1));
  self::assertInstanceOf(AccessResultNeutral::class, $this->accessCheck
    ->handleNode($node, $node
    ->language()
    ->getId()), 'Admin user is not allowed. But this user must be allowed.');
}