You are here

protected function LinkViewsTokensTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/link/tests/src/Functional/Views/LinkViewsTokensTest.php \Drupal\Tests\link\Functional\Views\LinkViewsTokensTest::setUp()

Overrides ViewTestBase::setUp

File

core/modules/link/tests/src/Functional/Views/LinkViewsTokensTest.php, line 46

Class

LinkViewsTokensTest
Tests the views integration for link tokens.

Namespace

Drupal\Tests\link\Functional\Views

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);
  ViewTestData::createTestViews(get_class($this), [
    'link_test_views',
  ]);

  // Create Basic page node type.
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);

  // Create a field.
  FieldStorageConfig::create([
    'field_name' => $this->fieldName,
    'type' => 'link',
    'entity_type' => 'node',
    'cardinality' => 1,
  ])
    ->save();
  FieldConfig::create([
    'field_name' => $this->fieldName,
    'entity_type' => 'node',
    'bundle' => 'page',
    'label' => 'link field',
  ])
    ->save();
}