|
|
@ -14,6 +14,7 @@ use Symfony\Component\Console\Input\InputArgument; |
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
|
|
|
|
use Throwable; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Command to lauch tests from command line accross all seacms dependencies |
|
|
|
* Command to lauch tests from command line accross all seacms dependencies |
|
|
@ -96,13 +97,36 @@ use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
// default display help |
|
|
|
// default display help |
|
|
|
$inputInternal = new ArrayInput([ |
|
|
|
return $this->runApplicationSafe([ |
|
|
|
'command' => 'help', |
|
|
|
'command' => 'help', |
|
|
|
'command_name' => 'seacms-test' |
|
|
|
'command_name' => 'seacms-test' |
|
|
|
]); |
|
|
|
],$output); |
|
|
|
(new Application())->run($inputInternal,$output); |
|
|
|
} |
|
|
|
return Command::SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* run safe new Application |
|
|
|
|
|
|
|
* @param array $def |
|
|
|
|
|
|
|
* @param OutputInterface $output |
|
|
|
|
|
|
|
* @return int errorCode |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected function runApplicationSafe(array $def, OutputInterface $output): int |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$app = new Application(); |
|
|
|
|
|
|
|
$app->setCatchExceptions(false); // force not catching exceptions |
|
|
|
|
|
|
|
$app->setAutoExit(false); // force not exiting |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$code = $app->run(new ArrayInput($def),$output); |
|
|
|
|
|
|
|
if ($code != 0 && $code != 2){ |
|
|
|
|
|
|
|
$output->writeln("<info>Commands {$def['command']} return code $code</info>"); |
|
|
|
|
|
|
|
return Command::FAILURE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Throwable $th){ |
|
|
|
|
|
|
|
$output->writeln("<info>Something went wrong ({$th->getMessage()} - code :{$th->getCode()} )</info>"); |
|
|
|
|
|
|
|
$output->writeln("<info>In file {$th->getFile()}(line {$th->getLine()})</infos>"); |
|
|
|
|
|
|
|
return Command::FAILURE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Command::SUCCESS; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -132,7 +156,7 @@ use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
return ($v == '--pversion') ? '--version' : $v; // hack to prevent bad caught |
|
|
|
return ($v == '--pversion') ? '--version' : $v; // hack to prevent bad caught |
|
|
|
},$args); |
|
|
|
},$args); |
|
|
|
} |
|
|
|
} |
|
|
|
(new Application())->run(new ArrayInput($def),$output); |
|
|
|
return $this->runApplicationSafe($def,$output); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$output->writeln('<info>phpunit not installed !</info>'); |
|
|
|
$output->writeln('<info>phpunit not installed !</info>'); |
|
|
|
} |
|
|
|
} |
|
|
|