function AddToAllBundlesConfigActionTest::testMissingLabel

Same name and namespace in other branches
  1. main core/modules/field/tests/src/Kernel/AddToAllBundlesConfigActionTest.php \Drupal\Tests\field\Kernel\AddToAllBundlesConfigActionTest::testMissingLabel()

Tests that the action fails when the label property is not set.

File

core/modules/field/tests/src/Kernel/AddToAllBundlesConfigActionTest.php, line 155

Class

AddToAllBundlesConfigActionTest
Tests Add To All Bundles Config Action.

Namespace

Drupal\Tests\field\Kernel

Code

public function testMissingLabel() : void {
  $contents = <<<YAML
  name: Instantiate field on all bundles
  config:
    import:
      entity_test_with_storage:
        - field.storage.entity_test.body
    actions:
      field.storage.entity_test.body:
        addToAllBundles:
          description: Set by config actions.
  YAML;
  $recipe = $this->createRecipe($contents);
  $this->expectException(ConfigActionException::class);
  $this->expectExceptionMessage('The `label` property must be set for entity_test.entity_test.body.');
  RecipeRunner::processRecipe($recipe);
}

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