function WildcardConfigActionsTest::testCreateForEach

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

Tests that the createForEach action works as expected in normal conditions.

File

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

Class

WildcardConfigActionsTest
Tests config actions targeting multiple entities using wildcards.

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testCreateForEach() : void {
  $this->enableModules([
    'image',
    'language',
  ]);
  /** @var \Drupal\Core\Config\Action\ConfigActionManager $manager */
  $manager = $this->container
    ->get('plugin.manager.config_action');
  $manager->applyAction('createForEach', 'node.type.*', [
    'language.content_settings.node.%bundle' => [
      'target_entity_type_id' => 'node',
      'target_bundle' => '%bundle',
    ],
  ]);
  $this->assertIsObject(ContentLanguageSettings::load('node.one'));
  $this->assertIsObject(ContentLanguageSettings::load('node.two'));
}

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