Completed
Push — master ( 39044b...ce5fed )
by Oleg
02:16
created

GetsTestCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 43
ccs 23
cts 23
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 25 1
A configure() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Command\Tests\Api;
5
6
use SlayerBirden\DFCodeGeneration\Command\AbstractApiCommand;
7
use SlayerBirden\DFCodeGeneration\Generator\Config\Providers\Decorators\EntityIdDecorator;
8
use SlayerBirden\DFCodeGeneration\Generator\Config\Providers\Decorators\OwnerDecorator;
9
use SlayerBirden\DFCodeGeneration\Generator\Controllers\Providers\Decorators\EntityNamePluralDecorator;
10
use SlayerBirden\DFCodeGeneration\Generator\Controllers\Providers\Decorators\RelationsProviderDecorator;
11
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\BaseProvider;
12
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\CachedProvider;
13
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\DecoratedProvider;
14
use SlayerBirden\DFCodeGeneration\Generator\Tests\Api\GetsGenerator;
15
use SlayerBirden\DFCodeGeneration\Generator\Tests\Api\Providers\Decorators\EntityDataDecorator;
16
use SlayerBirden\DFCodeGeneration\Generator\Tests\Api\Providers\Decorators\PluralDecorator;
17
use SlayerBirden\DFCodeGeneration\Generator\Tests\Api\ReflectionEntitySpecProvider;
18
use Symfony\Component\Console\Input\InputInterface;
19
use Symfony\Component\Console\Output\OutputInterface;
20
21
final class GetsTestCommand extends AbstractApiCommand
22
{
23 2
    protected function configure()
24
    {
25 2
        parent::configure();
26 2
        $this->setName('test:api:gets')
27 2
            ->setDescription('Api Test for get multiple action.')
28 2
            ->setHelp('This command creates the Codeception Api Test for Get Multiple Action for given entity.');
29 2
    }
30
31
    /**
32
     * {@inheritdoc}
33
     * @param InputInterface $input
34
     * @param OutputInterface $output
35
     * @throws \Twig_Error_Loader
36
     * @throws \Twig_Error_Runtime
37
     * @throws \Twig_Error_Syntax
38
     */
39 2
    protected function execute(InputInterface $input, OutputInterface $output)
40
    {
41 2
        $baseProvider = new BaseProvider($this->entityClassName);
42
43 2
        $generator = new GetsGenerator(
44 2
            new CachedProvider(
45 2
                new DecoratedProvider(
46 2
                    $baseProvider,
47 2
                    new EntityDataDecorator(
48 2
                        $this->entityClassName,
49 2
                        new ReflectionEntitySpecProvider($this->entityClassName)
50
                    ),
51 2
                    new PluralDecorator(
52 2
                        $this->entityClassName,
53 2
                        new ReflectionEntitySpecProvider($this->entityClassName)
54
                    ),
55 2
                    new RelationsProviderDecorator($this->entityClassName),
56 2
                    new OwnerDecorator($this->entityClassName),
57 2
                    new EntityNamePluralDecorator()
58
                )
59
            )
60
        );
61 2
        $this->writer->write($generator->generate(), $generator->getFileName());
0 ignored issues
show
Bug introduced by
The method write() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

61
        $this->writer->/** @scrutinizer ignore-call */ 
62
                       write($generator->generate(), $generator->getFileName());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
62
63 2
        parent::execute($input, $output);
64 2
    }
65
}
66