Completed
Push — master ( 8fb423...c81d0e )
by
unknown
04:06
created

MigrateAllCommandTest::testGetMigrationsConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace ReddogsTest\Doctrine\Migrations;
4
5
use Reddogs\Doctrine\Migrations\MigrateCommand;
6
use Reddogs\Doctrine\Migrations\MigrateAllCommand;
7
use Zend\Console\Adapter\AdapterInterface;
8
use ZF\Console\Route;
9
10
class MigrateAllCommandTest extends \PHPUnit_Framework_TestCase
11
{
12
    private $command, $migrateCommand, $migrationsConfig;
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...
13
14
    protected function setUp()
15
    {
16
        $this->migrateCommand = $this->getMockBuilder(MigrateCommand::class)
17
            ->disableOriginalConstructor()
18
            ->setMethods(['__invoke'])
19
            ->getMock();
20
21
        $this->migrationsConfig = [
22
            'testKey1' => [],
23
            'testKey2' => [],
24
        ];
25
26
        $this->command = new MigrateAllCommand($this->migrateCommand, $this->migrationsConfig);
27
    }
28
29
    public function testGetMigrateCommand()
30
    {
31
        $this->assertSame($this->migrateCommand, $this->command->getMigrateCommand());
32
    }
33
34
    public function testGetMigrationsConfig()
35
    {
36
        $this->assertSame($this->migrationsConfig, $this->command->getMigrationsConfig());
37
    }
38
39
    public function testInvoke()
40
    {
41
        $route = new Route('mogrations:migrate-all', 'mogrations:migrate-all');
42
        $console = $this->createMock(AdapterInterface::class);
43
44
        $migrateRoute1 = new Route('migrations:migrate', 'migrations:migrate testKey1');
45
        $migrateRoute2 = new Route('migrations:migrate', 'migrations:migrate testKey2');
46
47
        $this->migrateCommand->expects($this->at(0))
48
            ->method('__invoke')
49
            ->with($this->equalTo($migrateRoute1),
50
                   $this->equalTo($console));
51
52
        $this->migrateCommand->expects($this->at(1))
53
            ->method('__invoke')
54
            ->with($this->equalTo($migrateRoute2),
55
                   $this->equalTo($console));
56
57
        $this->command->__invoke($route, $console);
58
    }
59
}