function WildcardConfigActionsTest::testCreateForEachErrorsIfNoBundleEntityTypesExist

Tests that the createForEach action requires bundle entity types to exist.

File

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

Class

WildcardConfigActionsTest
Tests config actions targeting multiple entities using wildcards.

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testCreateForEachErrorsIfNoBundleEntityTypesExist() : void {
  $this->disableModules([
    'node',
    'entity_test',
  ]);
  $manager = $this->container
    ->get('plugin.manager.config_action');
  $manager->clearCachedDefinitions();
  $this->expectException(InvalidPluginDefinitionException::class);
  $this->expectExceptionMessage('The create_for_each_bundle:createForEach config action must be restricted to entity types that are bundles of another entity type.');
  $manager->applyAction('create_for_each_bundle:createForEach', 'node.type.*', []);
}

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