function FixtureManipulator::setUpRepos
Sets up the path repos at absolute paths.
1 call to FixtureManipulator::setUpRepos()
- FixtureManipulator::doCommitChanges in core/
modules/ package_manager/ tests/ modules/ fixture_manipulator/ src/ FixtureManipulator.php - Commits all the changes.
File
-
core/
modules/ package_manager/ tests/ modules/ fixture_manipulator/ src/ FixtureManipulator.php, line 627
Class
- FixtureManipulator
- Manipulates a test fixture using Composer commands.
Namespace
Drupal\fixture_manipulatorCode
public function setUpRepos() : void {
$fs = new SymfonyFileSystem();
$path_repo_base = \Drupal::state()->get(self::PATH_REPO_STATE_KEY);
if (empty($path_repo_base)) {
$path_repo_base = FileSystem::getOsTemporaryDirectory() . '/base-repo-' . microtime(TRUE) . rand(0, 10000);
\Drupal::state()->set(self::PATH_REPO_STATE_KEY, $path_repo_base);
// Copy the existing repos that were used to make the fixtures into the
// new folder.
$fs->mirror(__DIR__ . '/../../../fixtures/path_repos', $path_repo_base);
}
// Update all the repos in the composer.json file to point to the new
// repos at the absolute path.
$composer_json = file_get_contents($this->dir . '/packages.json');
assert(file_put_contents($this->dir . '/packages.json', str_replace('../path_repos/', "{$path_repo_base}/", $composer_json)) !== FALSE);
$this->runComposerCommand([
'update',
'--lock',
]);
$this->runComposerCommand([
'install',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.