/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$runner = new runner('atoum');
$bundles = $input->getArgument('bundles');
if (count($bundles) > 0) {
foreach ($bundles as $k => $bundleName) {
$bundles[$k] = $this->extractBundleConfigurationFromKernel($bundleName);
}
} else {
$bundles = $this->getContainer()->get('atoum.configuration.bundle.container')->all();
}
foreach ($bundles as $bundle) {
$directories = array_filter($bundle->getDirectories(), function ($dir) {
return is_dir($dir);
});
if (empty($directories)) {
$output->writeln(sprintf('<error>There is no test found on "%s".</error>', $bundle->getName()));
}
foreach ($directories as $directory) {
$runner->getRunner()->addTestsFromDirectory($directory);
}
}
$defaultBootstrap = sprintf('%s/autoload.php', $this->getApplication()->getKernel()->getRootDir());
$bootstrap = $input->getOption('bootstrap-file') ?: $defaultBootstrap;
$this->setAtoumArgument('--bootstrap-file', $bootstrap);
if ($input->getOption('no-code-coverage')) {
$this->setAtoumArgument('-ncc');
}
if ($input->getOption('max-children-number')) {
$this->setAtoumArgument('--max-children-number', (int) $input->getOption('max-children-number'));
}
$runner->run($this->getAtoumArguments());
}