You are here

public function AccessCheckTest::testNoGrantedTermRestriction in Permissions by Term 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/AccessCheckTest.php \Drupal\Tests\permissions_by_term\Kernel\AccessCheckTest::testNoGrantedTermRestriction()

File

tests/src/Kernel/AccessCheckTest.php, line 52

Class

AccessCheckTest
Class AccessCheckTest

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

public function testNoGrantedTermRestriction() : void {
  $database = $this->container
    ->get('database');
  $database
    ->truncate('node_access')
    ->execute();
  $this
    ->createRelationNoGrantedTerm();
  \Drupal::configFactory()
    ->getEditable('permissions_by_term.settings')
    ->set('require_all_terms_granted', FALSE)
    ->save();
  $this
    ->assertFalse($this->accessCheck
    ->canUserAccessByNode(Node::load($this
    ->getNidNoGrantedTerm())));
  node_access_rebuild();
  $gids = $this->accessStorage
    ->getGids(\Drupal::service('current_user'));
  self::assertNull($gids);
}