function WildcardConfigActionsTest::setUp

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Recipe/WildcardConfigActionsTest.php \Drupal\KernelTests\Core\Recipe\WildcardConfigActionsTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Recipe/WildcardConfigActionsTest.php, line 42

Class

WildcardConfigActionsTest
Tests config actions targeting multiple entities using wildcards.

Namespace

Drupal\KernelTests\Core\Recipe

Code

protected function setUp() : void {
    parent::setUp();
    $this->installConfig('node');
    $this->createContentType([
        'type' => 'one',
    ]);
    $this->createContentType([
        'type' => 'two',
    ]);
    EntityTestBundle::create([
        'id' => 'one',
    ])->save();
    EntityTestBundle::create([
        'id' => 'two',
    ])->save();
    $field_storage = FieldStorageConfig::create([
        'entity_type' => 'entity_test_with_bundle',
        'field_name' => 'field_test',
        'type' => 'boolean',
    ]);
    $field_storage->save();
    FieldConfig::create([
        'field_storage' => $field_storage,
        'bundle' => 'one',
    ])->save();
    FieldConfig::create([
        'field_storage' => $field_storage,
        'bundle' => 'two',
    ])->save();
    $field_storage = FieldStorageConfig::create([
        'entity_type' => 'node',
        'field_name' => 'field_test',
        'type' => 'boolean',
    ]);
    $field_storage->save();
    FieldConfig::create([
        'field_storage' => $field_storage,
        'bundle' => 'one',
    ])->save();
    FieldConfig::create([
        'field_storage' => $field_storage,
        'bundle' => 'two',
    ])->save();
}

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