/** * {@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')); } if ($input->getOption('xunit-report-file')) { $xunit = new \mageekguy\atoum\reports\asynchronous\xunit(); $runner->addReport($xunit); $writerXunit = new \mageekguy\atoum\writers\file($input->getOption('xunit-report-file')); $xunit->addWriter($writerXunit); } if ($input->getOption('clover-report-file')) { $clover = new \mageekguy\atoum\reports\asynchronous\clover(); $runner->addReport($clover); $writerClover = new \mageekguy\atoum\writers\file($input->getOption('clover-report-file')); $clover->addWriter($writerClover); } if ($input->getOption('xunit-report-file') || $input->getOption('clover-report-file')) { $reportCli = new \mageekguy\atoum\reports\realtime\cli(); $runner->addReport($reportCli); $writerCli = new \mageekguy\atoum\writers\std\out(); $reportCli->addWriter($writerCli); } $runner->run($this->getAtoumArguments()); }