function OverwriteExistingPackagesValidatorTest::testRecipeOverwriteIsAllowed

Same name and namespace in other branches
  1. main core/modules/package_manager/tests/src/Kernel/OverwriteExistingPackagesValidatorTest.php \Drupal\Tests\package_manager\Kernel\OverwriteExistingPackagesValidatorTest::testRecipeOverwriteIsAllowed()

Tests that things in the `recipes` directory can be overwritten.

File

core/modules/package_manager/tests/src/Kernel/OverwriteExistingPackagesValidatorTest.php, line 172

Class

OverwriteExistingPackagesValidatorTest
Tests Overwrite Existing Packages Validator.

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testRecipeOverwriteIsAllowed() : void {
  (new ActiveFixtureManipulator())->addProjectAtPath('recipes/test_recipe', file_name: 'recipe.yml')
    ->commitChanges();
  $stage_manipulator = $this->getStageFixtureManipulator();
  // This should not raise an error because, even though it's going to
  // overwrite an existing directory, it's at a path which specifically allows
  // that.
  $stage_manipulator->addPackage([
    'name' => 'drupal/test_recipe',
    'version' => '1.0.0',
    'type' => Recipe::COMPOSER_PROJECT_TYPE,
  ], FALSE, TRUE);
  $installer_paths = [
    'recipes/test_recipe' => [
      'drupal/test_recipe',
    ],
  ];
  $this->setInstallerPaths($installer_paths, $this->container
    ->get(PathLocator::class)
    ->getProjectRoot());
  $this->assertResults([], PreApplyEvent::class);
}

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