MigrateCommandTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace ReddogsTest\Doctrine\Migrations;
4
5
use Reddogs\Doctrine\Migrations\MigrateCommand;
6
use ZF\Console\Route;
7
use Reddogs\Doctrine\Migrations\ModuleConfig;
8
9 View Code Duplication
class MigrateCommandTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    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...
12
13
    protected function setUp()
14
    {
15
        $this->command = $this->getMockBuilder(MigrateCommand::class)
16
            ->disableOriginalConstructor()
17
            ->setMethods(['null'])
18
            ->getMock();
19
        $moduleConfig = (new ModuleConfig())->__invoke();
20
        $migrateParams = $moduleConfig['console_routes']['mogrations:migrate'];
21
        $this->route = new Route($migrateParams['name'], $migrateParams['route']);
22
    }
23
24
    public function testGetInputCommand()
25
    {
26
        $this->route->match(['mogrations:migrate']);
27
        $this->assertSame('migrations:migrate', $this->command->getInputCommand($this->route));
28
    }
29
30
    public function testGetInputCommandWithParams()
31
    {
32
        $this->route->match([
33
            'mogrations:migrate', 'testModuleName', '--version=testVersion', '--dry-run', '--write-sql',
34
            '--query-time', '-n', '-q', '--verbose'
35
        ]);
36
        $expected = 'migrations:migrate --dry-run --write-sql --query-time -n -q --verbose testVersion';
37
        $this->assertEquals($expected, $this->command->getInputCommand($this->route));
38
    }
39
}