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

AddTestCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
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 SlayerBirden\DFCodeGeneration\Generator\Config\Providers\Decorators\EntityIdDecorator;
8
use SlayerBirden\DFCodeGeneration\Generator\Controllers\Providers\Decorators\UniqueProviderDecorator;
9
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\BaseProvider;
10
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\CachedProvider;
11
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\DecoratedProvider;
12
use SlayerBirden\DFCodeGeneration\Generator\Tests\Api\AddGenerator;
13
use SlayerBirden\DFCodeGeneration\Generator\Tests\Api\Providers\Decorators\EntityDataDecorator;
14
use SlayerBirden\DFCodeGeneration\Generator\Tests\Api\ReflectionEntitySpecProvider;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
final class AddTestCommand extends AbstractApiCommand
19
{
20 2
    protected function configure()
21
    {
22 2
        parent::configure();
23 2
        $this->setName('test:api:add')
24 2
            ->setDescription('Api Test for add action.')
25 2
            ->setHelp('This command creates the Codeception Api Test for Add Action for given entity.');
26 2
    }
27
28
    /**
29
     * {@inheritdoc}
30
     * @param InputInterface $input
31
     * @param OutputInterface $output
32
     * @throws \Twig_Error_Loader
33
     * @throws \Twig_Error_Runtime
34
     * @throws \Twig_Error_Syntax
35
     */
36 2
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38 2
        $baseProvider = new BaseProvider($this->entityClassName);
39
40 2
        $generator = new AddGenerator(
41 2
            new CachedProvider(
42 2
                new DecoratedProvider(
43 2
                    $baseProvider,
44 2
                    new UniqueProviderDecorator($this->entityClassName),
45 2
                    new EntityDataDecorator(
46 2
                        $this->entityClassName,
47 2
                        new ReflectionEntitySpecProvider($this->entityClassName)
48
                    ),
49 2
                    new EntityIdDecorator($this->entityClassName)
50
                )
51
            )
52
        );
53 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

53
        $this->writer->/** @scrutinizer ignore-call */ 
54
                       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...
54
55 2
        parent::execute($input, $output);
56 2
    }
57
}
58