public function PermissionModeTest::testCanUserAccessByNodeId in Permissions by Term 8.2
File
- tests/
src/ Kernel/ PermissionModeTest.php, line 25
Class
- PermissionModeTest
- Class AccessCheckTest
Namespace
Drupal\Tests\permissions_by_term\KernelCode
public function testCanUserAccessByNodeId() : void {
$this
->createRelationWithoutRestriction();
self::assertInternalType('string', $this
->getNidNoRestriction());
self::assertTrue($this->accessCheck
->canUserAccessByNode(Node::load($this
->getNidNoRestriction())));
\Drupal::configFactory()
->getEditable('permissions_by_term.settings')
->set('permission_mode', TRUE)
->save();
self::assertFalse($this->accessCheck
->canUserAccessByNode(Node::load($this
->getNidNoRestriction())));
self::assertTrue($this->accessCheck
->canUserAccessByNode(Node::load($this
->getNidNoRestriction()), 1), 'Admin user is not allowed. But this user must be allowed.');
}