You are here

protected function EntityQueryAlterComplexTest::assertQueryAccessResult in Group 8

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

Asserts that the view returns the expected results.

Parameters

int[] $expected: The expected node IDs.

$message: The message for the assertion.

17 calls to EntityQueryAlterComplexTest::assertQueryAccessResult()
EntityQueryAlterComplexTest::testMemberAdminAccess in tests/src/Kernel/EntityQueryAlterComplexTest.php
Tests the admin access for members.
EntityQueryAlterComplexTest::testMemberGroupAccessWithoutPermission in tests/src/Kernel/EntityQueryAlterComplexTest.php
Tests that grouped nodes are properly hidden for members.
EntityQueryAlterComplexTest::testMemberGroupAccessWithPermission in tests/src/Kernel/EntityQueryAlterComplexTest.php
Tests that grouped nodes are visible to members.
EntityQueryAlterComplexTest::testMemberViewAnyPublishedAccess in tests/src/Kernel/EntityQueryAlterComplexTest.php
Tests the viewing of any published entities for members.
EntityQueryAlterComplexTest::testMemberViewAnyUnpublishedAccess in tests/src/Kernel/EntityQueryAlterComplexTest.php
Tests the viewing of any unpublished entities for members.

... See full list

File

tests/src/Kernel/EntityQueryAlterComplexTest.php, line 521

Class

EntityQueryAlterComplexTest
Tests that Group properly checks access for "complex" 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[] = [
      'nid' => $value,
    ];
  }
  $view = Views::getView('node_as_content');
  $view
    ->execute();
  $this
    ->assertIdenticalResultsetHelper($view, $views_expected, [
    'nid' => 'nid',
  ], 'assertEqualsCanonicalizing', $message);
}