Passed
Push — master ( 53f538...807973 )
by Oleg
02:07
created

DeleteTestCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 36
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A execute() 0 18 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\RelationsProviderDecorator;
10
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\BaseProvider;
11
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\CachedProvider;
12
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\DecoratedProvider;
13
use SlayerBirden\DFCodeGeneration\Generator\Tests\Api\DeleteGenerator;
14
use SlayerBirden\DFCodeGeneration\Generator\Tests\Api\Providers\Decorators\EntityDataDecorator;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
final class DeleteTestCommand extends AbstractApiCommand
19
{
20
    protected function configure()
21
    {
22
        parent::configure();
23
        $this->setName('test:api:delete')
24
            ->setDescription('Api Test for delete action.')
25
            ->setHelp('This command creates the Codeception Api Test for Delete Action for given entity.');
26
    }
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
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38
        $baseProvider = new BaseProvider($this->entityClassName);
39
40
        $generator = new DeleteGenerator(
41
            new CachedProvider(
42
                new DecoratedProvider(
43
                    $baseProvider,
44
                    new EntityDataDecorator($this->entityClassName),
45
                    new EntityIdDecorator($this->entityClassName),
46
                    new RelationsProviderDecorator($this->entityClassName),
47
                    new OwnerDecorator($this->entityClassName)
48
                )
49
            )
50
        );
51
        $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

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