RegisterMigrationsEventSubscriberTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testStatusCommand() 0 8 1
A testAvailableMigrations() 0 4 1
A getMigrationsDirectory() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zenify\DoctrineMigrations\Tests\EventSubscriber;
6
7
use Doctrine\DBAL\Migrations\Configuration\Configuration;
8
use Symfony\Component\Console\Input\ArrayInput;
9
use Symfony\Component\Console\Output\BufferedOutput;
10
11
12
final class RegisterMigrationsEventSubscriberTest extends AbstractEventSubscriberTest
13
{
14
15
	/**
16
	 * @var Configuration
17
	 */
18
	private $configuration;
19
20
21
	protected function setUp()
22
	{
23
		parent::setUp();
24
25
		$this->configuration = $this->container->getByType(Configuration::class);
26
		$this->configuration->setMigrationsDirectory($this->getMigrationsDirectory());
27
	}
28
29
30
	public function testStatusCommand()
31
	{
32
		$input = new ArrayInput(['command' => 'migrations:status']);
33
		$output = new BufferedOutput;
34
35
		$result = $this->application->run($input, $output);
36
		$this->assertSame(0, $result);
37
	}
38
39
40
	public function testAvailableMigrations()
41
	{
42
		$this->assertSame(2, $this->configuration->getNumberOfAvailableMigrations());
43
	}
44
45
46
	/**
47
	 * @return string
48
	 */
49
	private function getMigrationsDirectory()
50
	{
51
		return __DIR__ . '/../Migrations';
52
	}
53
54
}
55