function SqlTest::setupViewsData

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

Sets up the views data in the container.

Parameters

\Drupal\views\ViewsData $views_data: The views data.

1 call to SqlTest::setupViewsData()
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 124

Class

SqlTest
@coversDefaultClass \Drupal\views\Plugin\views\query\Sql

Namespace

Drupal\Tests\views\Unit\Plugin\query

Code

protected function setupViewsData(ViewsData $views_data) {
    $container = \Drupal::hasContainer() ? \Drupal::getContainer() : new ContainerBuilder();
    $container->set('views.views_data', $views_data);
    \Drupal::setContainer($container);
}

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