@@ 387-418 (lines=32) @@ | ||
384 | $this->assertSame('event_dispatcher', (string) $definition->getArgument(0)); |
|
385 | } |
|
386 | ||
387 | public function testShouldNotRegisterRegisterListenersServiceForNotDoctrineProvider() |
|
388 | { |
|
389 | $container = new ContainerBuilder(); |
|
390 | $container->setParameter('kernel.debug', true); |
|
391 | ||
392 | $extension = new FOSElasticaExtension(); |
|
393 | $extension->load([ |
|
394 | 'fos_elastica' => [ |
|
395 | 'clients' => [ |
|
396 | 'default' => ['host' => 'a_host', 'port' => 'a_port'], |
|
397 | ], |
|
398 | 'indexes' => [ |
|
399 | 'acme_index' => [ |
|
400 | 'types' => [ |
|
401 | 'acme_type' => [ |
|
402 | 'properties' => ['text' => null], |
|
403 | 'persistence' => [ |
|
404 | 'driver' => 'propel', |
|
405 | 'model' => 'theModelClass', |
|
406 | 'provider' => null, |
|
407 | 'listener' => null, |
|
408 | 'finder' => null, |
|
409 | ] |
|
410 | ] |
|
411 | ] |
|
412 | ] |
|
413 | ] |
|
414 | ] |
|
415 | ], $container); |
|
416 | ||
417 | $this->assertFalse($container->hasDefinition('fos_elastica.doctrine.register_listeners')); |
|
418 | } |
|
419 | ||
420 | public function testShouldRegisterFilterObjectsListener() |
|
421 | { |
|
@@ 498-529 (lines=32) @@ | ||
495 | $this->assertSame([], $listener->getArgument(0)); |
|
496 | } |
|
497 | ||
498 | public function testShouldRegisterDoctrineORMListener() |
|
499 | { |
|
500 | $container = new ContainerBuilder(); |
|
501 | $container->setParameter('kernel.debug', true); |
|
502 | ||
503 | $extension = new FOSElasticaExtension(); |
|
504 | $extension->load([ |
|
505 | 'fos_elastica' => [ |
|
506 | 'clients' => [ |
|
507 | 'default' => ['host' => 'a_host', 'port' => 'a_port'], |
|
508 | ], |
|
509 | 'indexes' => [ |
|
510 | 'acme_index' => [ |
|
511 | 'types' => [ |
|
512 | 'acme_type' => [ |
|
513 | 'properties' => ['text' => null], |
|
514 | 'persistence' => [ |
|
515 | 'driver' => 'orm', |
|
516 | 'model' => 'theModelClass', |
|
517 | 'provider' => null, |
|
518 | 'listener' => null, |
|
519 | 'finder' => null, |
|
520 | ] |
|
521 | ] |
|
522 | ] |
|
523 | ] |
|
524 | ] |
|
525 | ] |
|
526 | ], $container); |
|
527 | ||
528 | $this->assertTrue($container->hasDefinition('fos_elastica.listener.acme_index.acme_type')); |
|
529 | } |
|
530 | ||
531 | public function testShouldNotRegisterDoctrineORMListenerIfDisabled() |
|
532 | { |
|
@@ 531-564 (lines=34) @@ | ||
528 | $this->assertTrue($container->hasDefinition('fos_elastica.listener.acme_index.acme_type')); |
|
529 | } |
|
530 | ||
531 | public function testShouldNotRegisterDoctrineORMListenerIfDisabled() |
|
532 | { |
|
533 | $container = new ContainerBuilder(); |
|
534 | $container->setParameter('kernel.debug', true); |
|
535 | ||
536 | $extension = new FOSElasticaExtension(); |
|
537 | $extension->load([ |
|
538 | 'fos_elastica' => [ |
|
539 | 'clients' => [ |
|
540 | 'default' => ['host' => 'a_host', 'port' => 'a_port'], |
|
541 | ], |
|
542 | 'indexes' => [ |
|
543 | 'acme_index' => [ |
|
544 | 'types' => [ |
|
545 | 'acme_type' => [ |
|
546 | 'properties' => ['text' => null], |
|
547 | 'persistence' => [ |
|
548 | 'driver' => 'orm', |
|
549 | 'model' => 'theModelClass', |
|
550 | 'provider' => null, |
|
551 | 'listener' => [ |
|
552 | 'enabled' => false, |
|
553 | ], |
|
554 | 'finder' => null, |
|
555 | ] |
|
556 | ] |
|
557 | ] |
|
558 | ] |
|
559 | ] |
|
560 | ] |
|
561 | ], $container); |
|
562 | ||
563 | $this->assertFalse($container->hasDefinition('fos_elastica.listener.acme_index.acme_type')); |
|
564 | } |
|
565 | } |
|
566 |