Conditions | 1 |
Paths | 1 |
Total Lines | 33 |
Code Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
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 |