1 | <?php |
||
21 | class InjectEntityDefinitionsPassTest extends \PHPUnit_Framework_TestCase |
||
22 | { |
||
23 | public function testProcess() |
||
24 | { |
||
25 | $c = new ContainerBuilder; |
||
26 | $c->setParameter( |
||
27 | 'kernel.bundles', |
||
28 | [ |
||
29 | 'FixtureFooBundle' => FooBundle::class, |
||
30 | 'FixtureBarBundle' => BarBundle::class, |
||
31 | 'FixtureEmptyBundle' => EmptyBundle::class, |
||
32 | ] |
||
33 | ); |
||
34 | (new InnmindNeo4jExtension)->load([], $c); |
||
35 | $this->assertSame( |
||
36 | null, |
||
37 | ($p = new InjectEntityDefinitionsPass)->process($c) |
||
38 | ); |
||
39 | $this->assertInstanceOf(CompilerPassInterface::class, $p); |
||
40 | |||
41 | $def = $c->getDefinition('innmind_neo4j.metadata_builder'); |
||
42 | $calls = $def->getMethodCalls(); |
||
43 | |||
44 | $this->assertSame(1, count($calls)); |
||
45 | $this->assertSame('inject', $calls[0][0]); |
||
46 | $this->assertSame( |
||
47 | [ |
||
48 | [ |
||
49 | 'Foo' => [ |
||
50 | 'type' => 'aggregate', |
||
51 | 'identity' => [ |
||
52 | 'property' => 'uuid', |
||
53 | 'type' => Uuid::class, |
||
54 | ], |
||
55 | ], |
||
56 | ], |
||
57 | [ |
||
58 | 'Bar' => [ |
||
59 | 'type' => 'relationship', |
||
60 | 'identity' => [ |
||
61 | 'property' => 'uuid', |
||
62 | 'type' => Uuid::class, |
||
63 | ], |
||
64 | 'rel_type' => 'BAR', |
||
65 | 'startNode' => [ |
||
66 | 'property' => 'start', |
||
67 | 'type' => Uuid::class, |
||
68 | 'target' => 'uuid', |
||
69 | ], |
||
70 | 'endNode' => [ |
||
71 | 'property' => 'end', |
||
72 | 'type' => Uuid::class, |
||
73 | 'target' => 'uuid', |
||
74 | ], |
||
75 | ], |
||
76 | ], |
||
77 | ], |
||
78 | $calls[0][1][0] |
||
79 | ); |
||
80 | } |
||
81 | } |
||
82 |