You are here

public function EntityQueryAlterTest::testGroupAccessWithoutPermission in Group 8

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

Tests that grouped test entities are properly hidden for members.

File

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

Class

EntityQueryAlterTest
Tests that Group properly checks access for grouped entities.

Namespace

Drupal\Tests\group\Kernel

Code

public function testGroupAccessWithoutPermission() {
  $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
    ->assertQueryAccessResult([
    $entity_2
      ->id(),
  ], 'Only the ungrouped test entity shows up.');
}