You are here

protected function ViewKernelTestBase::setUpFixtures in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/ViewKernelTestBase.php \Drupal\views\Tests\ViewKernelTestBase::setUpFixtures()

Sets up the configuration and schema of views and views_test_data modules.

Because the schema of views_test_data.module is dependent on the test using it, it cannot be enabled normally.

6 calls to ViewKernelTestBase::setUpFixtures()
AreaEntityTest::setUpFixtures in core/modules/views/src/Tests/Handler/AreaEntityTest.php
Sets up the configuration and schema of views and views_test_data modules.
FieldEntityLinkTest::setUpFixtures in core/modules/views/src/Tests/Handler/FieldEntityLinkTest.php
Sets up the configuration and schema of views and views_test_data modules.
RelationshipJoinTestBase::setUpFixtures in core/modules/views/src/Tests/Plugin/RelationshipJoinTestBase.php
Sets up the configuration and schema of views and views_test_data modules.
RowRenderCacheTest::setUpFixtures in core/modules/views/src/Tests/Plugin/RowRenderCacheTest.php
Sets up the configuration and schema of views and views_test_data modules.
ViewExecutableTest::setUpFixtures in core/modules/views/src/Tests/ViewExecutableTest.php
Sets up the configuration and schema of views and views_test_data modules.

... See full list

5 methods override ViewKernelTestBase::setUpFixtures()
AreaEntityTest::setUpFixtures in core/modules/views/src/Tests/Handler/AreaEntityTest.php
Sets up the configuration and schema of views and views_test_data modules.
FieldEntityLinkTest::setUpFixtures in core/modules/views/src/Tests/Handler/FieldEntityLinkTest.php
Sets up the configuration and schema of views and views_test_data modules.
RelationshipJoinTestBase::setUpFixtures in core/modules/views/src/Tests/Plugin/RelationshipJoinTestBase.php
Sets up the configuration and schema of views and views_test_data modules.
RowRenderCacheTest::setUpFixtures in core/modules/views/src/Tests/Plugin/RowRenderCacheTest.php
Sets up the configuration and schema of views and views_test_data modules.
ViewExecutableTest::setUpFixtures in core/modules/views/src/Tests/ViewExecutableTest.php
Sets up the configuration and schema of views and views_test_data modules.

File

core/modules/views/src/Tests/ViewKernelTestBase.php, line 59
Contains \Drupal\views\Tests\ViewKernelTestBase.

Class

ViewKernelTestBase
Defines a base class for Views unit testing.

Namespace

Drupal\views\Tests

Code

protected function setUpFixtures() {

  // First install the system module. Many Views have Page displays have menu
  // links, and for those to work, the system menus must already be present.
  $this
    ->installConfig(array(
    'system',
  ));

  // Define the schema and views data variable before enabling the test module.
  \Drupal::state()
    ->set('views_test_data_schema', $this
    ->schemaDefinition());
  \Drupal::state()
    ->set('views_test_data_views_data', $this
    ->viewsData());
  $this
    ->installConfig(array(
    'views',
    'views_test_config',
    'views_test_data',
  ));
  foreach ($this
    ->schemaDefinition() as $table => $schema) {
    $this
      ->installSchema('views_test_data', $table);
  }
  \Drupal::service('router.builder')
    ->rebuild();

  // Load the test dataset.
  $data_set = $this
    ->dataSet();
  $query = db_insert('views_test_data')
    ->fields(array_keys($data_set[0]));
  foreach ($data_set as $record) {
    $query
      ->values($record);
  }
  $query
    ->execute();
}