PreMigrationEventTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace RDV\Bundle\MigrationBundle\Tests\Unit\Event;
4
5
use RDV\Bundle\MigrationBundle\Event\PreMigrationEvent;
6
7
class PreMigrationEventTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * @var PreMigrationEvent
11
     */
12
    protected $preMigrationEvent;
13
14
    protected function setUp()
15
    {
16
        $connection = $this->getMockBuilder('Doctrine\DBAL\Connection')
17
            ->disableOriginalConstructor()
18
            ->getMock();
19
        $this->preMigrationEvent = new PreMigrationEvent($connection);
20
    }
21
22
    public function testLoadedVersions()
23
    {
24
        $this->preMigrationEvent->setLoadedVersion('testBundle', 'v1_0');
25
        $this->assertEquals(['testBundle' => 'v1_0'], $this->preMigrationEvent->getLoadedVersions());
26
        $this->assertEquals('v1_0', $this->preMigrationEvent->getLoadedVersion('testBundle'));
27
        $this->assertNull($this->preMigrationEvent->getLoadedVersion('nonLoggedBundle'));
28
    }
29
}
30