@@ 70-124 (lines=55) @@ | ||
67 | $this->assertFalse($containerBuilder->hasDefinition('fos_elastica.object_persister.test_index.driverless')); |
|
68 | } |
|
69 | ||
70 | public function testShouldRegisterDoctrineORMPagerProviderIfEnabled() |
|
71 | { |
|
72 | $container = new ContainerBuilder(); |
|
73 | $container->setParameter('kernel.debug', true); |
|
74 | ||
75 | $extension = new FOSElasticaExtension(); |
|
76 | $extension->load([ |
|
77 | 'fos_elastica' => [ |
|
78 | 'clients' => [ |
|
79 | 'default' => ['host' => 'a_host', 'port' => 'a_port'], |
|
80 | ], |
|
81 | 'indexes' => [ |
|
82 | 'acme_index' => [ |
|
83 | 'types' => [ |
|
84 | 'acme_type' => [ |
|
85 | 'properties' => ['text' => null], |
|
86 | 'persistence' => [ |
|
87 | 'driver' => 'orm', |
|
88 | 'model' => 'theModelClass', |
|
89 | 'provider' => null, |
|
90 | 'listener' => null, |
|
91 | 'finder' => null, |
|
92 | ] |
|
93 | ] |
|
94 | ] |
|
95 | ] |
|
96 | ] |
|
97 | ] |
|
98 | ], $container); |
|
99 | ||
100 | $this->assertTrue($container->hasDefinition('fos_elastica.pager_provider.acme_index.acme_type')); |
|
101 | ||
102 | $definition = $container->getDefinition('fos_elastica.pager_provider.acme_index.acme_type'); |
|
103 | $this->assertInstanceOf(ChildDefinition::class, $definition); |
|
104 | $this->assertSame('fos_elastica.pager_provider.prototype.orm', $definition->getParent()); |
|
105 | $this->assertSame('theModelClass', $definition->getArgument(2)); |
|
106 | $this->assertSame([ |
|
107 | 'batch_size' => 100, |
|
108 | 'clear_object_manager' => true, |
|
109 | 'debug_logging' => true, |
|
110 | 'query_builder_method' => 'createQueryBuilder', |
|
111 | ], $definition->getArgument(3)); |
|
112 | ||
113 | $this->assertSame([ |
|
114 | 'fos_elastica.pager_provider' => [ |
|
115 | ['index' => 'acme_index', 'type' => 'acme_type'], |
|
116 | ] |
|
117 | ], $definition->getTags()); |
|
118 | ||
119 | $this->assertTrue($container->hasDefinition('fos_elastica.pager_provider.prototype.orm')); |
|
120 | $this->assertSame( |
|
121 | ORMPagerProvider::class, |
|
122 | $container->getDefinition('fos_elastica.pager_provider.prototype.orm')->getClass() |
|
123 | ); |
|
124 | } |
|
125 | ||
126 | public function testShouldRegisterDoctrineMongoDBPagerProviderIfEnabled() |
|
127 | { |
|
@@ 246-300 (lines=55) @@ | ||
243 | ); |
|
244 | } |
|
245 | ||
246 | public function testShouldRegisterPropel1PagerProviderIfEnabled() |
|
247 | { |
|
248 | $container = new ContainerBuilder(); |
|
249 | $container->setParameter('kernel.debug', true); |
|
250 | ||
251 | $extension = new FOSElasticaExtension(); |
|
252 | $extension->load([ |
|
253 | 'fos_elastica' => [ |
|
254 | 'clients' => [ |
|
255 | 'default' => ['host' => 'a_host', 'port' => 'a_port'], |
|
256 | ], |
|
257 | 'indexes' => [ |
|
258 | 'acme_index' => [ |
|
259 | 'types' => [ |
|
260 | 'acme_type' => [ |
|
261 | 'properties' => ['text' => null], |
|
262 | 'persistence' => [ |
|
263 | 'driver' => 'propel', |
|
264 | 'model' => 'theModelClass', |
|
265 | 'provider' => null, |
|
266 | 'listener' => null, |
|
267 | 'finder' => null, |
|
268 | ] |
|
269 | ] |
|
270 | ] |
|
271 | ] |
|
272 | ] |
|
273 | ] |
|
274 | ], $container); |
|
275 | ||
276 | $this->assertTrue($container->hasDefinition('fos_elastica.pager_provider.acme_index.acme_type')); |
|
277 | ||
278 | $definition = $container->getDefinition('fos_elastica.pager_provider.acme_index.acme_type'); |
|
279 | $this->assertInstanceOf(ChildDefinition::class, $definition); |
|
280 | $this->assertSame('fos_elastica.pager_provider.prototype.propel', $definition->getParent()); |
|
281 | $this->assertSame('theModelClass', $definition->getArgument(0)); |
|
282 | $this->assertSame([ |
|
283 | 'batch_size' => 100, |
|
284 | 'clear_object_manager' => true, |
|
285 | 'debug_logging' => true, |
|
286 | 'query_builder_method' => 'createQueryBuilder', |
|
287 | ], $definition->getArgument(1)); |
|
288 | ||
289 | $this->assertSame([ |
|
290 | 'fos_elastica.pager_provider' => [ |
|
291 | ['index' => 'acme_index', 'type' => 'acme_type'], |
|
292 | ] |
|
293 | ], $definition->getTags()); |
|
294 | ||
295 | $this->assertTrue($container->hasDefinition('fos_elastica.pager_provider.prototype.propel')); |
|
296 | $this->assertSame( |
|
297 | Propel1PagerProvider::class, |
|
298 | $container->getDefinition('fos_elastica.pager_provider.prototype.propel')->getClass() |
|
299 | ); |
|
300 | } |
|
301 | ||
302 | public function testShouldRegisterInPlacePagerPersister() |
|
303 | { |