EventSourcingConfiguratorTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetRepositoryByServiceId_FromTestContainer_ShouldReturnExpectedInstance() 0 8 1
A testGetRepositoryByClassName_FromTestContainer_ShouldReturnExpectedInstance() 0 8 1
A testGetRepositoryByType_FromTestContainer_ShouldReturnExpectedInstance() 0 9 1
1
<?php declare(strict_types = 1);
2
3
namespace TomCizek\SymfonyProoph\Tests\EventSourcing;
4
5
use TomCizek\SymfonyProoph\Tests\Configurators\ProophTestCase;
6
use TomCizek\SymfonyProoph\Tests\EventSourcing\FakeImplementations\MemoryTestRepository;
7
use TomCizek\SymfonyProoph\Tests\EventSourcing\FakeImplementations\MemoryTestRepositoryInterface;
8
9
class EventSourcingConfiguratorTest extends ProophTestCase
10
{
11
	private const FIXTURE_CONFIG_FILE = 'EventSourcingConfiguratorTest.yml';
12
13
	public function testGetRepositoryByServiceId_FromTestContainer_ShouldReturnExpectedInstance()
14
	{
15
		$this->givenContainerWithLoadedBundlesWithGivenConfig(self::FIXTURE_CONFIG_FILE);
16
17
		$repository = $this->whenGetFromContainer('prooph.event_sourcing.test_repository');
18
19
		$this->thenIsInstanceOfGivenClass(MemoryTestRepository::class, $repository);
20
	}
21
22
	public function testGetRepositoryByClassName_FromTestContainer_ShouldReturnExpectedInstance()
23
	{
24
		$this->givenContainerWithLoadedBundlesWithGivenConfig(self::FIXTURE_CONFIG_FILE);
25
26
		$repository = $this->whenGetFromContainer(MemoryTestRepository::class);
27
28
		$this->thenIsInstanceOfGivenClass(MemoryTestRepository::class, $repository);
29
	}
30
31
	public function testGetRepositoryByType_FromTestContainer_ShouldReturnExpectedInstance()
32
	{
33
		$this->givenContainerWithLoadedBundlesWithGivenConfig(self::FIXTURE_CONFIG_FILE);
34
35
		$repository = $this->whenGetFromContainer(MemoryTestRepositoryInterface::class);
36
37
		$this->thenIsInstanceOfGivenClass(MemoryTestRepository::class, $repository);
38
		$this->thenIsInstanceOfGivenClass(MemoryTestRepositoryInterface::class, $repository);
39
	}
40
}
41