GenerateCommandTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 26
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 1
A testGetInputCommand() 0 4 1
A testGetInputCommandWithParams() 0 5 1
1
<?php
2
3
namespace Reddogs\Doctrine\Migrations;
4
5
use ZF\Console\Route;
6
7
class GenerateCommandTest extends \PHPUnit_Framework_TestCase
8
{
9
    private $command, $route;
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
10
11
    protected function setUp()
12
    {
13
        $this->command = $this->getMockBuilder(GenerateCommand::class)
14
                              ->disableOriginalConstructor()
15
                              ->setMethods(['null'])
16
                              ->getMock();
17
        $moduleConfig = (new ModuleConfig())->__invoke();
18
        $migrateParams = $moduleConfig['console_routes']['mogrations:generate'];
19
        $this->route = new Route($migrateParams['name'], $migrateParams['route']);
20
    }
21
22
    public function testGetInputCommand()
23
    {
24
        $this->assertSame('migrations:generate', $this->command->getInputCommand($this->route));
25
    }
26
27
    public function testGetInputCommandWithParams()
28
    {
29
        $this->route->match(['mogrations:generate', 'testModuleName', '-q', '-n', '-v']);
30
        $this->assertEquals('migrations:generate -q -n -v', $this->command->getInputCommand($this->route));
31
    }
32
}