Passed
Push — feature/lg ( 3c06af...b2e7fb )
by Richard
03:07
created

TestsGeneratorCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
eloc 13
c 2
b 0
f 0
dl 0
loc 62
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getOptions() 0 3 1
A getArguments() 0 3 1
A handle() 0 11 1
A __construct() 0 5 1
1
<?php
2
3
namespace PWWEB\Artomator\Commands\API;
4
5
use InfyOm\Generator\Generators\API\APITestGenerator;
6
use InfyOm\Generator\Generators\RepositoryTestGenerator;
7
use PWWEB\Artomator\Commands\BaseCommand;
8
use PWWEB\Artomator\Common\CommandData;
9
10
class TestsGeneratorCommand extends BaseCommand
11
{
12
    /**
13
     * The console command name.
14
     *
15
     * @var string
16
     */
17
    protected $name = 'artomator.api:tests';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Create tests command';
25
26
    /**
27
     * Create a new command instance.
28
     */
29
    public function __construct()
30
    {
31
        parent::__construct();
32
33
        $this->commandData = new CommandData($this, CommandData::$COMMAND_TYPE_API);
34
    }
35
36
    /**
37
     * Execute the command.
38
     *
39
     * @return void
40
     */
41
    public function handle()
42
    {
43
        parent::handle();
44
45
        $repositoryTestGenerator = new RepositoryTestGenerator($this->commandData);
46
        $repositoryTestGenerator->generate();
47
48
        $apiTestGenerator = new APITestGenerator($this->commandData);
49
        $apiTestGenerator->generate();
50
51
        $this->performPostActions();
52
    }
53
54
    /**
55
     * Get the console command options.
56
     *
57
     * @return array
58
     */
59
    public function getOptions()
60
    {
61
        return array_merge(parent::getOptions(), []);
62
    }
63
64
    /**
65
     * Get the console command arguments.
66
     *
67
     * @return array
68
     */
69
    protected function getArguments()
70
    {
71
        return array_merge(parent::getArguments(), []);
72
    }
73
}
74