You are here

protected function CreateSampleEntityTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 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 44

Class

CreateSampleEntityTest
Tests the ContentEntityStorageBase::createWithSampleValues method.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function setUp() {
  parent::setup();
  $this
    ->installEntitySchema('file');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('node_type');
  $this
    ->installEntitySchema('file');
  $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();
}