You are here

public function AccessCheckTest::testRequireAllTermsGrantedWithNoRestrictedTerms in Permissions by Term 8.2

File

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

Class

AccessCheckTest
Class AccessCheckTest

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

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