@@ 126-184 (lines=59) @@ | ||
123 | ); |
|
124 | } |
|
125 | ||
126 | public function testShouldRegisterDoctrineMongoDBPagerProviderIfEnabled() |
|
127 | { |
|
128 | if (!class_exists(\Doctrine\ODM\MongoDB\DocumentManager::class)) { |
|
129 | $this->markTestSkipped('Doctrine MongoDB ODM is not available.'); |
|
130 | } |
|
131 | ||
132 | $container = new ContainerBuilder(); |
|
133 | $container->setParameter('kernel.debug', true); |
|
134 | ||
135 | $extension = new FOSElasticaExtension(); |
|
136 | $extension->load([ |
|
137 | 'fos_elastica' => [ |
|
138 | 'clients' => [ |
|
139 | 'default' => ['host' => 'a_host', 'port' => 'a_port'], |
|
140 | ], |
|
141 | 'indexes' => [ |
|
142 | 'acme_index' => [ |
|
143 | 'types' => [ |
|
144 | 'acme_type' => [ |
|
145 | 'properties' => ['text' => null], |
|
146 | 'persistence' => [ |
|
147 | 'driver' => 'mongodb', |
|
148 | 'model' => 'theModelClass', |
|
149 | 'provider' => null, |
|
150 | 'listener' => null, |
|
151 | 'finder' => null, |
|
152 | ] |
|
153 | ] |
|
154 | ] |
|
155 | ] |
|
156 | ] |
|
157 | ] |
|
158 | ], $container); |
|
159 | ||
160 | $this->assertTrue($container->hasDefinition('fos_elastica.pager_provider.acme_index.acme_type')); |
|
161 | ||
162 | $definition = $container->getDefinition('fos_elastica.pager_provider.acme_index.acme_type'); |
|
163 | $this->assertInstanceOf(ChildDefinition::class, $definition); |
|
164 | $this->assertSame('fos_elastica.pager_provider.prototype.mongodb', $definition->getParent()); |
|
165 | $this->assertSame('theModelClass', $definition->getArgument(2)); |
|
166 | $this->assertSame([ |
|
167 | 'batch_size' => 100, |
|
168 | 'clear_object_manager' => true, |
|
169 | 'debug_logging' => true, |
|
170 | 'query_builder_method' => 'createQueryBuilder', |
|
171 | ], $definition->getArgument(3)); |
|
172 | ||
173 | $this->assertSame([ |
|
174 | 'fos_elastica.pager_provider' => [ |
|
175 | ['index' => 'acme_index', 'type' => 'acme_type'], |
|
176 | ] |
|
177 | ], $definition->getTags()); |
|
178 | ||
179 | $this->assertTrue($container->hasDefinition('fos_elastica.pager_provider.prototype.mongodb')); |
|
180 | $this->assertSame( |
|
181 | MongoDBPagerProvider::class, |
|
182 | $container->getDefinition('fos_elastica.pager_provider.prototype.mongodb')->getClass() |
|
183 | ); |
|
184 | } |
|
185 | ||
186 | public function testShouldRegisterDoctrinePHPCRPagerProviderIfEnabled() |
|
187 | { |
|
@@ 186-244 (lines=59) @@ | ||
183 | ); |
|
184 | } |
|
185 | ||
186 | public function testShouldRegisterDoctrinePHPCRPagerProviderIfEnabled() |
|
187 | { |
|
188 | if (!class_exists(\Doctrine\ODM\PHPCR\DocumentManager::class)) { |
|
189 | $this->markTestSkipped('Doctrine PHPCR is not present'); |
|
190 | } |
|
191 | ||
192 | $container = new ContainerBuilder(); |
|
193 | $container->setParameter('kernel.debug', true); |
|
194 | ||
195 | $extension = new FOSElasticaExtension(); |
|
196 | $extension->load([ |
|
197 | 'fos_elastica' => [ |
|
198 | 'clients' => [ |
|
199 | 'default' => ['host' => 'a_host', 'port' => 'a_port'], |
|
200 | ], |
|
201 | 'indexes' => [ |
|
202 | 'acme_index' => [ |
|
203 | 'types' => [ |
|
204 | 'acme_type' => [ |
|
205 | 'properties' => ['text' => null], |
|
206 | 'persistence' => [ |
|
207 | 'driver' => 'phpcr', |
|
208 | 'model' => 'theModelClass', |
|
209 | 'provider' => null, |
|
210 | 'listener' => null, |
|
211 | 'finder' => null, |
|
212 | ] |
|
213 | ] |
|
214 | ] |
|
215 | ] |
|
216 | ] |
|
217 | ] |
|
218 | ], $container); |
|
219 | ||
220 | $this->assertTrue($container->hasDefinition('fos_elastica.pager_provider.acme_index.acme_type')); |
|
221 | ||
222 | $definition = $container->getDefinition('fos_elastica.pager_provider.acme_index.acme_type'); |
|
223 | $this->assertInstanceOf(ChildDefinition::class, $definition); |
|
224 | $this->assertSame('fos_elastica.pager_provider.prototype.phpcr', $definition->getParent()); |
|
225 | $this->assertSame('theModelClass', $definition->getArgument(2)); |
|
226 | $this->assertSame([ |
|
227 | 'batch_size' => 100, |
|
228 | 'clear_object_manager' => true, |
|
229 | 'debug_logging' => true, |
|
230 | 'query_builder_method' => 'createQueryBuilder', |
|
231 | ], $definition->getArgument(3)); |
|
232 | ||
233 | $this->assertSame([ |
|
234 | 'fos_elastica.pager_provider' => [ |
|
235 | ['index' => 'acme_index', 'type' => 'acme_type'], |
|
236 | ] |
|
237 | ], $definition->getTags()); |
|
238 | ||
239 | $this->assertTrue($container->hasDefinition('fos_elastica.pager_provider.prototype.phpcr')); |
|
240 | $this->assertSame( |
|
241 | PHPCRPagerProvider::class, |
|
242 | $container->getDefinition('fos_elastica.pager_provider.prototype.phpcr')->getClass() |
|
243 | ); |
|
244 | } |
|
245 | ||
246 | public function testShouldRegisterPropel1PagerProviderIfEnabled() |
|
247 | { |