function SqlTest::setupEntityTypeManager

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php \Drupal\Tests\views\Unit\Plugin\query\SqlTest::setupEntityTypeManager()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php \Drupal\Tests\views\Unit\Plugin\query\SqlTest::setupEntityTypeManager()
  3. 10 core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php \Drupal\Tests\views\Unit\Plugin\query\SqlTest::setupEntityTypeManager()

Sets up the entity type manager in the container.

Parameters

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

1 call to SqlTest::setupEntityTypeManager()
SqlTest::setupEntityTypes in core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php
Sets up some test entity types and corresponding views data.

File

core/modules/views/tests/src/Unit/Plugin/query/SqlTest.php, line 138

Class

SqlTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21query%21Sql.php/class/Sql/11.x" title="Views query plugin for an SQL query." class="local">\Drupal\views\Plugin\views\query\Sql</a>

Namespace

Drupal\Tests\views\Unit\Plugin\query

Code

protected function setupEntityTypeManager(EntityTypeManagerInterface $entity_type_manager) {
    $container = \Drupal::hasContainer() ? \Drupal::getContainer() : new ContainerBuilder();
    $container->set('entity_type.manager', $entity_type_manager);
    \Drupal::setContainer($container);
}

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