public function BlockContentEntityReferenceSelectionTest::testQueriesNotAltered in Drupal 9
Same name and namespace in other branches
- 8 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 122 
Class
- BlockContentEntityReferenceSelectionTest
- Tests EntityReference selection handlers don't return non-reusable blocks.
Namespace
Drupal\Tests\block_content\KernelCode
public function testQueriesNotAltered() {
  // 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());
}