function LinkViewsTokensTest::setUp

Same name in other branches
  1. 9 core/modules/link/tests/src/Functional/Views/LinkViewsTokensTest.php \Drupal\Tests\link\Functional\Views\LinkViewsTokensTest::setUp()
  2. 10 core/modules/link/tests/src/Functional/Views/LinkViewsTokensTest.php \Drupal\Tests\link\Functional\Views\LinkViewsTokensTest::setUp()
  3. 11.x 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();
}

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