You are here

public function EntityAccessCheckTest::testBaseAccessControl in Permissions by Term 8.2

Same name and namespace in other branches
  1. 8 modules/permissions_by_entity/tests/src/Kernel/EntityAccessCheckTest.php \Drupal\Tests\permissions_by_entity\Kernel\EntityAccessCheckTest::testBaseAccessControl()

Tests basic access control.

File

modules/permissions_by_entity/tests/src/Kernel/EntityAccessCheckTest.php, line 93

Class

EntityAccessCheckTest
Class EntityAccessCheckTest

Namespace

Drupal\Tests\permissions_by_entity\Kernel

Code

public function testBaseAccessControl() {
  self::assertTrue($this->accessChecker
    ->isAccessAllowed($this->nodes['test_entity_term_a'], $this->terms['term_user_a']['user']
    ->id()));
  self::assertTrue($this->accessChecker
    ->isAccessAllowed($this->nodes['test_entity_term_b'], $this->terms['term_user_b']['user']
    ->id()));
  self::assertFalse($this->accessChecker
    ->isAccessAllowed($this->nodes['test_entity_term_b'], $this->terms['term_user_a']['user']
    ->id()));
  self::assertFalse($this->accessChecker
    ->isAccessAllowed($this->nodes['test_entity_term_a'], $this->terms['term_user_b']['user']
    ->id()));
}