function CreateSampleEntityTest::setUp

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php \Drupal\KernelTests\Core\Entity\CreateSampleEntityTest::setUp()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php \Drupal\KernelTests\Core\Entity\CreateSampleEntityTest::setUp()
  3. 11.x core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php \Drupal\KernelTests\Core\Entity\CreateSampleEntityTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php, line 46

Class

CreateSampleEntityTest
Tests the ContentEntityStorageBase::createWithSampleValues method.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('file');
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installEntitySchema('node_type');
    $this->installEntitySchema('comment');
    $this->installEntitySchema('comment_type');
    $this->installEntitySchema('path_alias');
    $this->installEntitySchema('taxonomy_vocabulary');
    $this->installEntitySchema('taxonomy_term');
    $this->entityTypeManager = $this->container
        ->get('entity_type.manager');
    NodeType::create([
        'type' => 'article',
        'name' => 'Article',
    ])->save();
    NodeType::create([
        'type' => 'page',
        'name' => 'Page',
    ])->save();
    Vocabulary::create([
        'name' => 'Tags',
        'vid' => 'tags',
    ])->save();
}

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