function TaxonomyQueryAlterTest::assertQueryTagTestResult

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php \Drupal\Tests\taxonomy\Kernel\TaxonomyQueryAlterTest::assertQueryTagTestResult()
  2. 8.9.x core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php \Drupal\Tests\taxonomy\Kernel\TaxonomyQueryAlterTest::assertQueryTagTestResult()
  3. 10 core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php \Drupal\Tests\taxonomy\Kernel\TaxonomyQueryAlterTest::assertQueryTagTestResult()

Verifies invocation of the hooks in the test module.

@internal

Parameters

int $expected_generic_invocations: The number of times the generic query_alter hook is expected to have been invoked.

int $expected_specific_invocations: The number of times the tag-specific query_alter hooks are expected to have been invoked.

1 call to TaxonomyQueryAlterTest::assertQueryTagTestResult()
TaxonomyQueryAlterTest::testTaxonomyQueryAlter in core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php
Tests that appropriate tags are added when querying the database.

File

core/modules/taxonomy/tests/src/Kernel/TaxonomyQueryAlterTest.php, line 142

Class

TaxonomyQueryAlterTest
Tests that appropriate query tags are added.

Namespace

Drupal\Tests\taxonomy\Kernel

Code

protected function assertQueryTagTestResult(int $expected_generic_invocations, int $expected_specific_invocations) : void {
    $state = $this->container
        ->get('state');
    $this->assertEquals($expected_generic_invocations, $state->get('taxonomy_test_query_alter'));
    $this->assertEquals($expected_specific_invocations, $state->get('taxonomy_test_query_term_access_alter'));
    $this->assertEquals($expected_specific_invocations, $state->get('taxonomy_test_query_taxonomy_term_access_alter'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.