Completed
Push — master ( c540fc...cbb59f )
by Oleg
01:55
created

AllTestsCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 2
dl 0
loc 11
ccs 0
cts 7
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Command\Tests\Api;
5
6
use SlayerBirden\DFCodeGeneration\Command\AbstractApiCommand;
7
use Symfony\Component\Console\Input\ArrayInput;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
final class AllTestsCommand extends AbstractApiCommand
12
{
13
    private $commands = [
14
        'test:api:add',
15
        'test:api:delete',
16
        'test:api:get',
17
        'test:api:gets',
18
        'test:api:update',
19
    ];
20
21
    protected function configure()
22
    {
23
        parent::configure();
24
        $this->setName('test:api:all')
25
            ->setDescription('Api Tests for all actions.')
26
            ->setHelp('This command creates the Codeception Api Tests for all Actions for given entity.');
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        foreach ($this->commands as $commandName) {
35
            $command = $this->getApplication()->find($commandName);
36
37
            $arguments = array(
38
                'entity' => $this->entityClassName,
39
                '--force' => $this->force,
40
            );
41
            $greetInput = new ArrayInput($arguments);
42
            $command->run($greetInput, $output);
43
        }
44
    }
45
}
46