LoadConfigurationTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 11 1
A testLoadConfiguration() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zenify\DoctrineMigrations\Tests\DI\MigrationsExtension;
6
7
use Arachne\EventDispatcher\DI\EventDispatcherExtension;
8
use Nette\DI\Compiler;
9
use Nette\DI\ContainerBuilder;
10
use PHPUnit\Framework\TestCase;
11
use Zenify\DoctrineMigrations\Configuration\Configuration;
12
use Zenify\DoctrineMigrations\DI\MigrationsExtension;
13
14
15
class LoadConfigurationTest extends TestCase
16
{
17
18
	/**
19
	 * @var MigrationsExtension
20
	 */
21
	private $extension;
22
23
24
	protected function setUp()
25
	{
26
		$containerBuilder = new ContainerBuilder;
27
		$containerBuilder->parameters = ['appDir' => __DIR__];
28
29
		$compiler = new Compiler($containerBuilder);
30
		$compiler->addExtension('events', new EventDispatcherExtension);
31
32
		$this->extension = new MigrationsExtension;
33
		$this->extension->setCompiler($compiler, 'migrations');
34
	}
35
36
37
	public function testLoadConfiguration()
38
	{
39
		$this->extension->loadConfiguration();
40
		$containerBuilder = $this->extension->getContainerBuilder();
41
		$containerBuilder->prepareClassList();
42
43
		$configurationDefinition = $containerBuilder->getDefinition($containerBuilder->getByType(Configuration::class));
44
		$this->assertSame(Configuration::class, $configurationDefinition->getClass());
45
	}
46
47
}
48