fix(--verbose): test
This commit is contained in:
parent
1935601cc7
commit
00a9c6d298
@ -13,6 +13,8 @@ use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Throwable;
|
||||
|
||||
@ -116,9 +118,18 @@ use Throwable;
|
||||
$app->setCatchExceptions(false); // force not catching exceptions
|
||||
$app->setAutoExit(false); // force not exiting
|
||||
try {
|
||||
// if ($output instanceof ConsoleOutputInterface){
|
||||
// $errBuffer = new BufferedOutput();
|
||||
// $output->setErrorOutput($errBuffer);
|
||||
// }
|
||||
$code = $app->run(new ArrayInput($def),$output);
|
||||
if ($code != 0 && $code != 2){
|
||||
if ($code != 0){
|
||||
$output->writeln("<info>Commands {$def['command']} return code $code</info>");
|
||||
// if ($errBuffer){
|
||||
// $errorOutput = $errBuffer->fetch();
|
||||
// $output->writeln("<warning>Error</warning>");
|
||||
// $output->writeln($errorOutput);
|
||||
// }
|
||||
return Command::FAILURE;
|
||||
}
|
||||
} catch (Throwable $th){
|
||||
@ -149,8 +160,13 @@ use Throwable;
|
||||
if ($this->canRunPhpunit()){
|
||||
$def = [
|
||||
'command' => 'exec',
|
||||
'binary' => 'phpunit'
|
||||
'binary' => 'phpunit',
|
||||
// '-v' => '-v', // only for debug command exec
|
||||
];
|
||||
$args = array_merge([
|
||||
// '-v' => '--verbose', // verbse phpunit
|
||||
// '--debug' => '--debug', // debug phpunit
|
||||
],$args);
|
||||
if (!empty($args)){
|
||||
$def['args'] = array_map(function($v){
|
||||
return ($v == '--pversion') ? '--version' : $v; // hack to prevent bad caught
|
||||
|
Loading…
x
Reference in New Issue
Block a user