4 * This file is part of the Behat Testwork.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Testwork\Suite\Cli;
13 use Behat\Testwork\Cli\Controller;
14 use Behat\Testwork\Suite\SuiteBootstrapper;
15 use Behat\Testwork\Suite\SuiteRepository;
16 use Symfony\Component\Console\Command\Command;
17 use Symfony\Component\Console\Input\InputInterface;
18 use Symfony\Component\Console\Input\InputOption;
19 use Symfony\Component\Console\Output\OutputInterface;
22 * Initializes registered test suites.
24 * @author Konstantin Kudryashov <ever.zet@gmail.com>
26 final class InitializationController implements Controller
29 * @var SuiteRepository
33 * @var SuiteBootstrapper
35 private $bootstrapper;
38 * Initializes controller.
40 * @param SuiteRepository $repository
41 * @param SuiteBootstrapper $bootstrapper
43 public function __construct(SuiteRepository $repository, SuiteBootstrapper $bootstrapper)
45 $this->repository = $repository;
46 $this->bootstrapper = $bootstrapper;
52 public function configure(Command $command)
54 $command->addOption('--init', null, InputOption::VALUE_NONE,
55 'Initialize all registered test suites.'
62 public function execute(InputInterface $input, OutputInterface $output)
64 if (!$input->getOption('init')) {
68 $suites = $this->repository->getSuites();
69 $this->bootstrapper->bootstrapSuites($suites);
71 $output->write(PHP_EOL);