You are here

public function EntityQueryAlterTest::testNonMemberGroupAccessWithoutPermission in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/EntityQueryAlterTest.php \Drupal\Tests\group\Kernel\EntityQueryAlterTest::testNonMemberGroupAccessWithoutPermission()

Tests that grouped test entities are properly hidden for non-members.

File

tests/src/Kernel/EntityQueryAlterTest.php, line 93

Class

EntityQueryAlterTest
Tests that Group properly checks access for grouped entities.

Namespace

Drupal\Tests\group\Kernel

Code

public function testNonMemberGroupAccessWithoutPermission() {
  $entity_1 = $this
    ->createTestEntity();
  $entity_2 = $this
    ->createTestEntity();
  $group = $this
    ->createGroup([
    'type' => $this->groupTypeA
      ->id(),
  ]);
  $group
    ->addContent($entity_1, 'entity_test_as_content');
  $this
    ->assertQueryAccessResult([
    $entity_2
      ->id(),
  ], 'Only the ungrouped test entity shows up.');
}