function BaseFieldOverrideValidationTest::setUp

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Entity/BaseFieldOverrideValidationTest.php \Drupal\KernelTests\Core\Entity\BaseFieldOverrideValidationTest::setUp()

Overrides ConfigEntityValidationTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Entity/BaseFieldOverrideValidationTest.php, line 30

Class

BaseFieldOverrideValidationTest
Tests validation of base_field_override entities.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function setUp() : void {
    parent::setUp();
    $this->installConfig('node');
    $this->createContentType([
        'type' => 'one',
    ]);
    $this->createContentType([
        'type' => 'another',
    ]);
    EntityTestBundle::create([
        'id' => 'one',
    ])->save();
    EntityTestBundle::create([
        'id' => 'another',
    ])->save();
    $fields = $this->container
        ->get('entity_field.manager')
        ->getBaseFieldDefinitions('node');
    $this->entity = BaseFieldOverride::createFromBaseFieldDefinition($fields['uuid'], 'one');
    $this->entity
        ->save();
}

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