function RecipeRunnerTest::testConfigActions

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

File

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

Class

RecipeRunnerTest
@coversDefaultClass \Drupal\Core\Recipe\RecipeRunner @group Recipe

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.