function ArgumentSummaryTest::setUp

Same name in other branches
  1. 10 core/modules/views/tests/src/Kernel/Handler/ArgumentSummaryTest.php \Drupal\Tests\views\Kernel\Handler\ArgumentSummaryTest::setUp()

Overrides ViewsKernelTestBase::setUp

File

core/modules/views/tests/src/Kernel/Handler/ArgumentSummaryTest.php, line 62

Class

ArgumentSummaryTest
Tests the summary of results when an argument is not provided.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

protected function setUp($import_test_views = TRUE) : void {
    parent::setUp($import_test_views);
    $this->installEntitySchema('node');
    $this->installEntitySchema('taxonomy_term');
    $this->installEntitySchema('user');
    // Create the content type with an autocomplete tagging field.
    $this->nodeType = NodeType::create([
        'type' => 'article',
        'name' => 'Article',
    ]);
    $this->nodeType
        ->save();
    // Create the vocabulary for the tag field.
    $this->tagVocabulary = Vocabulary::create([
        'name' => 'Views testing tags',
        'vid' => 'views_testing_tags',
    ]);
    $this->tagVocabulary
        ->save();
    // Create the tag field itself.
    $handler_settings = [
        'target_bundles' => [
            $this->tagVocabulary
                ->id() => $this->tagVocabulary
                ->id(),
        ],
        'auto_create' => TRUE,
    ];
    $this->createEntityReferenceField('node', $this->nodeType
        ->id(), 'field_tags', NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
}

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