EventStoreConfiguratorTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetEventStoreByName_FromTestContainer_ShouldReturnExpectedInstance() 0 8 1
A testGetEventStoreByType_FromTestContainer_ShouldReturnExpectedInstance() 0 8 1
A testBootKernel_WithConfigWithoutEventStoreFactory_ShouldThrowBadConfigurationException() 0 6 1
1
<?php declare(strict_types = 1);
2
3
namespace TomCizek\SymfonyProoph\Tests\EventStore;
4
5
use Prooph\EventStore\EventStore;
6
use TomCizek\SymfonyProoph\BadConfigurationException;
7
use TomCizek\SymfonyProoph\Tests\Configurators\ProophTestCase;
8
9
class EventStoreConfiguratorTest extends ProophTestCase
10
{
11
	private const FIXTURE_CONFIG_FILE = 'EventStoreConfiguratorTest.yml';
12
	private const FIXTURE_CONFIG_FILE_WITHOUT_FACTORY = 'Invalid/EventStoreConfiguratorWithoutFactoryTest.yml';
13
14
	public function testGetEventStoreByName_FromTestContainer_ShouldReturnExpectedInstance()
15
	{
16
		$this->givenContainerWithLoadedBundlesWithGivenConfig(self::FIXTURE_CONFIG_FILE);
17
18
		$eventStoreService = $this->whenGetFromContainer('prooph.event_store.default');
19
20
		$this->thenIsInstanceOfGivenClass(EventStore::class, $eventStoreService);
21
	}
22
23
	public function testGetEventStoreByType_FromTestContainer_ShouldReturnExpectedInstance()
24
	{
25
		$this->givenContainerWithLoadedBundlesWithGivenConfig(self::FIXTURE_CONFIG_FILE);
26
27
		$eventStoreService = $this->whenGetFromContainer(EventStore::class);
28
29
		$this->thenIsInstanceOfGivenClass(EventStore::class, $eventStoreService);
30
	}
31
32
	public function testBootKernel_WithConfigWithoutEventStoreFactory_ShouldThrowBadConfigurationException()
33
	{
34
		$this->willThrowException(BadConfigurationException::class);
35
36
		$this->whenBootKernelWithConfig(self::FIXTURE_CONFIG_FILE_WITHOUT_FACTORY);
37
	}
38
}
39