You are here

protected function FieldTestBase::setUp in Drupal 8

Same name in this branch
  1. 8 core/modules/field/src/Tests/Views/FieldTestBase.php \Drupal\field\Tests\Views\FieldTestBase::setUp()
  2. 8 core/modules/field/tests/src/Functional/Views/FieldTestBase.php \Drupal\Tests\field\Functional\Views\FieldTestBase::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides ViewTestBase::setUp

File

core/modules/field/src/Tests/Views/FieldTestBase.php, line 52

Class

FieldTestBase
Provides some helper methods for testing fieldapi integration into views.

Namespace

Drupal\field\Tests\Views

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);

  // Ensure the page node type exists.
  NodeType::create([
    'type' => 'page',
    'name' => 'page',
  ])
    ->save();
  ViewTestData::createTestViews(get_class($this), [
    'field_test_views',
  ]);
}