function FixturesBase::runComposer
Runs a `composer` command.
Parameters
string $cmd: The Composer command to execute (escaped as required)
string $cwd: The current working directory to run the command from.
Return value
string Standard output and standard error from the command.
File
-
core/
tests/ Drupal/ Tests/ Composer/ Plugin/ FixturesBase.php, line 258
Class
- FixturesBase
- Base class for fixtures to test composer plugins.
Namespace
Drupal\Tests\Composer\PluginCode
public function runComposer(string $cmd, string $cwd) : string {
chdir($cwd);
$input = new StringInput($cmd);
$output = new BufferedOutput();
$application = new Application();
$application->setAutoExit(FALSE);
$exitCode = $application->run($input, $output);
$output = $output->fetch();
if ($exitCode != 0) {
throw new \Exception("Fixtures::runComposer failed to set up fixtures.\n\nCommand: '{$cmd}'\nExit code: {$exitCode}\nOutput: \n\n{$output}");
}
return $output;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.