You are here

protected function EntityReferenceSettingsTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/EntityReference/EntityReferenceSettingsTest.php \Drupal\field\Tests\EntityReference\EntityReferenceSettingsTest::setUp()

Performs setup tasks before each individual test method is run.

Overrides KernelTestBase::setUp

File

core/modules/field/src/Tests/EntityReference/EntityReferenceSettingsTest.php, line 54
Contains \Drupal\field\Tests\EntityReference\EntityReferenceSettingsTest.

Class

EntityReferenceSettingsTest
Tests entity reference field settings.

Namespace

Drupal\field\Tests\EntityReference

Code

protected function setUp() {
  parent::setup();
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('taxonomy_term');
  $this
    ->installEntitySchema('entity_test');
  $this->nodeType = NodeType::create([
    'type' => Unicode::strtolower($this
      ->randomMachineName()),
    'name' => $this
      ->randomString(),
  ]);
  $this->nodeType
    ->save();
  $this->vocabulary = Vocabulary::create([
    'vid' => Unicode::strtolower($this
      ->randomMachineName()),
    'name' => $this
      ->randomString(),
  ]);
  $this->vocabulary
    ->save();

  // Create a custom bundle.
  $this->customBundle = 'test_bundle_' . Unicode::strtolower($this
    ->randomMachineName());
  entity_test_create_bundle($this->customBundle, NULL, 'entity_test');
}