function BlockContentEntityReferenceSelectionTest::testQueriesNotAltered

Same name in other branches
  1. 9 core/modules/block_content/tests/src/Kernel/BlockContentEntityReferenceSelectionTest.php \Drupal\Tests\block_content\Kernel\BlockContentEntityReferenceSelectionTest::testQueriesNotAltered()
  2. 8.9.x core/modules/block_content/tests/src/Kernel/BlockContentEntityReferenceSelectionTest.php \Drupal\Tests\block_content\Kernel\BlockContentEntityReferenceSelectionTest::testQueriesNotAltered()
  3. 11.x core/modules/block_content/tests/src/Kernel/BlockContentEntityReferenceSelectionTest.php \Drupal\Tests\block_content\Kernel\BlockContentEntityReferenceSelectionTest::testQueriesNotAltered()

Tests to make sure queries without the expected tags are not altered.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

core/modules/block_content/tests/src/Kernel/BlockContentEntityReferenceSelectionTest.php, line 123

Class

BlockContentEntityReferenceSelectionTest
Tests EntityReference selection handlers don't return non-reusable blocks.

Namespace

Drupal\Tests\block_content\Kernel

Code

public function testQueriesNotAltered() : void {
    // Ensure that queries without all the tags are not altered.
    $query = $this->entityTypeManager
        ->getStorage('block_content')
        ->getQuery()
        ->accessCheck(FALSE);
    $this->assertCount(2, $query->execute());
    $query = $this->entityTypeManager
        ->getStorage('block_content')
        ->getQuery()
        ->accessCheck(FALSE);
    $query->addTag('block_content_access');
    $this->assertCount(2, $query->execute());
    $query = $this->entityTypeManager
        ->getStorage('block_content')
        ->getQuery()
        ->accessCheck(FALSE);
    $query->addTag('entity_query_block_content');
    $this->assertCount(2, $query->execute());
}

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