ChooseTestsController   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 35
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A configure() 0 4 1
A execute() 0 6 3
1
<?php
2
3
namespace Bex\Behat\ChooseTestsExtension\Controller;
4
5
use Behat\Gherkin\Node\FeatureNode;
6
use Behat\Testwork\Cli\Controller;
7
use Behat\Testwork\Specification\SpecificationFinder;
8
use Behat\Testwork\Suite\SuiteRepository;
9
use Bex\Behat\ChooseTestsExtension\ServiceContainer\Config;
10
use Symfony\Component\Console\Command\Command as SymfonyCommand;
11
use Symfony\Component\Console\Helper\QuestionHelper;
12
use Symfony\Component\Console\Input\InputInterface;
13
use Symfony\Component\Console\Input\InputOption;
14
use Symfony\Component\Console\Output\OutputInterface;
15
use Symfony\Component\Console\Question\ChoiceQuestion;
16
17
class ChooseTestsController implements Controller
18
{
19
    /**
20
     * @var Config
21
     */
22
    private $config;
23
    
24
    /**
25
     * @param Config $config
26
     */
27
    public function __construct(Config $config)
28
    {
29
        $this->config = $config;
30
    }
31
32
    /**
33
     * Configures command to be executable by the controller.
34
     *
35
     * @param SymfonyCommand $command
36
     */
37
    public function configure(SymfonyCommand $command)
38
    {
39
        $command->addOption('--choose-tests', null, InputOption::VALUE_NONE, 'Choose tests');
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function execute(InputInterface $input, OutputInterface $output)
46
    {
47
        if ($input->getOption('choose-tests') && $input->isInteractive()) {
48
            $this->config->enableAll();
49
        }
50
    }
51
}
52