public function EntityQueryAlterTest::testNonMemberGroupAccessWithPermission in Group 8
Same name and namespace in other branches
- 2.0.x tests/src/Kernel/EntityQueryAlterTest.php \Drupal\Tests\group\Kernel\EntityQueryAlterTest::testNonMemberGroupAccessWithPermission()
Tests that grouped test entities are visible to non-members.
File
- tests/
src/ Kernel/ EntityQueryAlterTest.php, line 121
Class
- EntityQueryAlterTest
- Tests that Group properly checks access for grouped entities.
Namespace
Drupal\Tests\group\KernelCode
public function testNonMemberGroupAccessWithPermission() {
$entity_1 = $this
->createTestEntity();
$entity_2 = $this
->createTestEntity();
$this->groupTypeA
->getOutsiderRole()
->grantPermission('administer entity_test_as_content')
->save();
$group = $this
->createGroup([
'type' => $this->groupTypeA
->id(),
]);
$group
->addContent($entity_1, 'entity_test_as_content');
$this
->createGroup([
'type' => $this->groupTypeA
->id(),
]);
$this
->assertQueryAccessResult([
$entity_1
->id(),
$entity_2
->id(),
], 'Outsiders can see grouped test entities');
}