function RecipeTestTrait::alterRecipe
Alters an existing recipe.
Parameters
string $path: The recipe directory path.
callable $alter: A function that will receive the decoded contents of recipe.yml as an array. This should returned a modified array to be written to recipe.yml.
3 calls to RecipeTestTrait::alterRecipe()
- ConfigConfiguratorTest::testExistingConfigIsIgnoredInLenientMode in core/tests/ Drupal/ KernelTests/ Core/ Recipe/ ConfigConfiguratorTest.php 
- Tests existing config is ignored in lenient mode.
- ConfigConfiguratorTest::testFullStrictness in core/tests/ Drupal/ KernelTests/ Core/ Recipe/ ConfigConfiguratorTest.php 
- Tests strict mode.
- ConfigConfiguratorTest::testSelectiveStrictness in core/tests/ Drupal/ KernelTests/ Core/ Recipe/ ConfigConfiguratorTest.php 
- Tests with strict mode on part of the configuration.
File
- 
              core/tests/ Drupal/ FunctionalTests/ Core/ Recipe/ RecipeTestTrait.php, line 126 
Class
- RecipeTestTrait
- Contains helper methods for interacting with recipes in functional tests.
Namespace
Drupal\FunctionalTests\Core\RecipeCode
protected function alterRecipe(string $path, callable $alter) : void {
  $file = $path . '/recipe.yml';
  $this->assertFileExists($file);
  $contents = file_get_contents($file);
  $contents = Yaml::decode($contents);
  $contents = $alter($contents);
  file_put_contents($file, Yaml::encode($contents));
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
