public function Fixtures::runComposer in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures::runComposer()
- 10 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures::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/ Scaffold/ Fixtures.php, line 384
Class
- Fixtures
- Convenience class for creating fixtures.
Namespace
Drupal\Tests\Composer\Plugin\ScaffoldCode
public function runComposer($cmd, $cwd) {
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;
}