4 * This file is part of the Behat.
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\Tester\Cli;
13 use Behat\Testwork\Cli\Controller;
14 use Behat\Testwork\Tester\Result\Interpretation\StrictInterpretation;
15 use Behat\Testwork\Tester\Result\ResultInterpreter;
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 * Configures Testwork to interpret test results strictly.
24 * @author Konstantin Kudryashov <ever.zet@gmail.com>
26 final class StrictController implements Controller
29 * @var ResultInterpreter
31 private $resultInterpreter;
38 * Initializes controller.
40 * @param ResultInterpreter $resultInterpreter
41 * @param Boolean $strict
43 public function __construct(ResultInterpreter $resultInterpreter, $strict = false)
45 $this->resultInterpreter = $resultInterpreter;
46 $this->strict = $strict;
52 public function configure(Command $command)
54 $command->addOption('--strict', null, InputOption::VALUE_NONE,
55 'Passes only if all tests are explicitly passing.'
62 public function execute(InputInterface $input, OutputInterface $output)
64 if (!$this->strict && !$input->getOption('strict')) {
68 $this->resultInterpreter->registerResultInterpretation(new StrictInterpretation());