public function EntityAccessTest::testMemberGroupAccessWithoutPermission in Group 2.0.x
Same name and namespace in other branches
- 8 tests/src/Kernel/EntityAccessTest.php \Drupal\Tests\group\Kernel\EntityAccessTest::testMemberGroupAccessWithoutPermission()
Tests that grouped test entities are properly hidden.
File
- tests/
src/ Kernel/ EntityAccessTest.php, line 78
Class
- EntityAccessTest
- Tests that Group properly checks access for grouped entities.
Namespace
Drupal\Tests\group\KernelCode
public function testMemberGroupAccessWithoutPermission() {
$entity_1 = $this
->createTestEntity();
$entity_2 = $this
->createTestEntity();
$group = $this
->createGroup([
'type' => $this->groupTypeA
->id(),
]);
$group
->addContent($entity_1, 'entity_test_as_content');
$group
->addMember($this
->getCurrentUser());
$this
->assertFalse($this->accessControlHandler
->access($entity_1, 'view'), 'Cannot view the grouped test entity.');
$this
->assertTrue($this->accessControlHandler
->access($entity_2, 'view'), 'Only the ungrouped test entity shows up.');
}