You are here

protected function RelationshipNodeTermDataTest::assertQueriesTermAccessTag in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/Views/RelationshipNodeTermDataTest.php \Drupal\Tests\taxonomy\Functional\Views\RelationshipNodeTermDataTest::assertQueriesTermAccessTag()
  2. 10 core/modules/taxonomy/tests/src/Functional/Views/RelationshipNodeTermDataTest.php \Drupal\Tests\taxonomy\Functional\Views\RelationshipNodeTermDataTest::assertQueriesTermAccessTag()

Assert views queries have taxonomy_term_access tag.

Parameters

\Drupal\views\ViewExecutable $view: The View to check for the term access tag.

bool $hasTag: The expected existence of taxonomy_term_access tag.

1 call to RelationshipNodeTermDataTest::assertQueriesTermAccessTag()
RelationshipNodeTermDataTest::testTag in core/modules/taxonomy/tests/src/Functional/Views/RelationshipNodeTermDataTest.php
Tests that the 'taxonomy_term_access' tag is added to the Views query.

File

core/modules/taxonomy/tests/src/Functional/Views/RelationshipNodeTermDataTest.php, line 98

Class

RelationshipNodeTermDataTest
Tests the taxonomy term on node relationship handler.

Namespace

Drupal\Tests\taxonomy\Functional\Views

Code

protected function assertQueriesTermAccessTag(ViewExecutable $view, $hasTag) {
  $main_query = $view->build_info['query'];
  $count_query = $view->build_info['count_query'];
  foreach ([
    $main_query,
    $count_query,
  ] as $query) {
    $tables = $query
      ->getTables();
    foreach ($tables as $join_table) {
      if (is_object($join_table['table'])) {
        $this
          ->assertSame($join_table['table']
          ->hasTag('taxonomy_term_access'), $hasTag);
      }
    }
  }
}