RegisterMigrationsEventSubscriberTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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