Completed
Push — develop ( 7f6ad2...eb155e )
by Baptiste
02:38
created

RepositoryFactoryConfiguratorTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 36
ccs 0
cts 31
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B testConfigure() 0 33 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Tests\Innmind\Neo4jBundle\Configurator;
5
6
use Innmind\Neo4jBundle\Configurator\RepositoryFactoryConfigurator;
7
use Innmind\Neo4j\ONM\{
8
    Metadata\ClassName,
9
    Metadata\Alias,
10
    Metadata\EntityInterface,
11
    Metadatas,
12
    RepositoryInterface,
13
    RepositoryFactory,
14
    UnitOfWork,
15
    Translation\MatchTranslator,
16
    Translation\SpecificationTranslator
17
};
18
19
class RepositoryFactoryConfiguratorTest extends \PHPUnit_Framework_TestCase
20
{
21
    public function testConfigure()
22
    {
23
        $entity = $this->getMock(EntityInterface::class);
24
        $entity
25
            ->method('class')
26
            ->willReturn(new ClassName('foo'));
27
        $entity
28
            ->method('alias')
29
            ->willReturn(new Alias('foo'));
30
        $m = new Metadatas;
31
        $m->register($entity);
32
        $c = new RepositoryFactoryConfigurator($m);
33
        $c->register('foo', $r = $this->getMock(RepositoryInterface::class));
34
        $f = new RepositoryFactory(
35
            $this
36
                ->getMockBuilder(UnitOfWork::class)
37
                ->disableOriginalConstructor()
38
                ->getMock(),
39
            $this
40
                ->getMockBuilder(MatchTranslator::class)
41
                ->disableOriginalConstructor()
42
                ->getMock(),
43
            $this
44
                ->getMockBuilder(SpecificationTranslator::class)
45
                ->disableOriginalConstructor()
46
                ->getMock()
47
        );
48
49
        $f2 = $c->configure($f);
50
51
        $this->assertSame($f, $f2);
52
        $this->assertSame($r, $f->make($entity));
53
    }
54
}
55