PreMigrationEventTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testLoadedVersions() 0 7 1
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