function PackageManagerFixtureCreator::runComposerCommand

Runs a Composer command at the fixture root.

Parameters

array $command: The command to run as passed to \Symfony\Component\Process\Process::__construct.

Return value

string The Composer command output.

1 call to PackageManagerFixtureCreator::runComposerCommand()
PackageManagerFixtureCreator::createFixture in core/scripts/PackageManagerFixtureCreator.php
Creates the fixture.

File

core/scripts/PackageManagerFixtureCreator.php, line 78

Class

PackageManagerFixtureCreator
Creates fixture at 'core/modules/package_manager/tests/fixtures/fake_site'.

Code

private static function runComposerCommand(array $command) : string {
  array_unshift($command, 'composer');
  $command[] = "--working-dir=" . static::FIXTURE_PATH;
  $process = new Process($command, env: [
    'COMPOSER_MIRROR_PATH_REPOS' => '1',
  ]);
  $process->run();
  if (!$process->isSuccessful()) {
    throw new ProcessFailedException($process);
  }
  return $process->getOutput();
}

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