function WildcardConfigActionsTest::setUp

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

Class

WildcardConfigActionsTest
Tests config actions targeting multiple entities using wildcards.

Namespace

Drupal\KernelTests\Core\Recipe

Code

protected function setUp() : void {
  parent::setUp();
  $this->installEntitySchema('node');
  $this->installConfig('node');
  $this->createContentType([
    'type' => 'one',
    'name' => 'Type A',
  ]);
  $this->createContentType([
    'type' => 'two',
    'name' => 'Type B',
  ]);
  $this->installEntitySchema('entity_test_with_bundle');
  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.