You are here

protected function EntityQueryAlterTest::assertQueryAccessResult in Group 2.0.x

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

Asserts that the view returns the expected results.

Parameters

int[] $expected: The expected test entity IDs.

$message: The message for the assertion.

11 calls to EntityQueryAlterTest::assertQueryAccessResult()
EntityQueryAlterTest::testGroupAccessWithoutPermission in tests/src/Kernel/EntityQueryAlterTest.php
Tests that grouped test entities are properly hidden for members.
EntityQueryAlterTest::testMemberGroupAccessWithPermission in tests/src/Kernel/EntityQueryAlterTest.php
Tests that grouped test entities are visible to members.
EntityQueryAlterTest::testMemberViewAnyAccess in tests/src/Kernel/EntityQueryAlterTest.php
Tests the viewing of any entities for members.
EntityQueryAlterTest::testMemberViewOwnAccess in tests/src/Kernel/EntityQueryAlterTest.php
Tests the viewing of own entities for members.
EntityQueryAlterTest::testNewGroupContent in tests/src/Kernel/EntityQueryAlterTest.php
Tests that adding new group content clears caches.

... See full list

File

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

Class

EntityQueryAlterTest
Tests that Group properly checks access for grouped entities.

Namespace

Drupal\Tests\group\Kernel

Code

protected function assertQueryAccessResult($expected, $message) {
  $ids = $this->storage
    ->getQuery()
    ->execute();
  $this
    ->assertEqualsCanonicalizing($expected, array_keys($ids), $message);
  $views_expected = [];
  foreach ($expected as $value) {
    $views_expected[] = [
      'id' => $value,
    ];
  }
  $view = Views::getView('entity_test_as_content');
  $view
    ->execute();
  $this
    ->assertIdenticalResultsetHelper($view, $views_expected, [
    'id' => 'id',
  ], 'assertEqualsCanonicalizing', $message);
}