function RecipeRunnerTest::testConfigActions

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Recipe/RecipeRunnerTest.php \Drupal\KernelTests\Core\Recipe\RecipeRunnerTest::testConfigActions()
  2. 10 core/tests/Drupal/KernelTests/Core/Recipe/RecipeRunnerTest.php \Drupal\KernelTests\Core\Recipe\RecipeRunnerTest::testConfigActions()

Tests a recipe that has actions.

File

core/tests/Drupal/KernelTests/Core/Recipe/RecipeRunnerTest.php, line 202

Class

RecipeRunnerTest
Tests Drupal\Core\Recipe\RecipeRunner.

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testConfigActions() : void {
  // Test the state prior to applying the recipe.
  $this->assertEmpty($this->container
    ->get('config.factory')
    ->listAll('config_test.'), 'There is no config_test configuration');
  $recipe = Recipe::createFromDirectory('core/tests/fixtures/recipes/config_actions');
  RecipeRunner::processRecipe($recipe);
  // Test the state after to applying the recipe.
  $storage = \Drupal::entityTypeManager()->getStorage('config_test');
  $config_test_entity = $storage->load('recipe');
  $this->assertInstanceOf(ConfigTest::class, $config_test_entity);
  $this->assertSame('Created by recipe', $config_test_entity->label());
  $this->assertSame('Set by recipe', $config_test_entity->getProtectedProperty());
  $this->assertSame('not bar', $this->config('config_test.system')
    ->get('foo'));
}

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