@@ 488-503 (lines=16) @@ | ||
485 | $this->assertEquals('YamlBundle\Cache\MyCacheFactory', $slcDefinition->getClass()); |
|
486 | } |
|
487 | ||
488 | public function testBundleEntityAliases() |
|
489 | { |
|
490 | $container = $this->getContainer(); |
|
491 | $extension = new DoctrineExtension(); |
|
492 | ||
493 | $config = BundleConfigurationBuilder::createBuilder() |
|
494 | ->addBaseConnection() |
|
495 | ->build(); |
|
496 | $config['orm'] = ['default_entity_manager' => 'default', 'entity_managers' => ['default' => ['mappings' => ['YamlBundle' => []]]]]; |
|
497 | $extension->load([$config], $container); |
|
498 | ||
499 | $definition = $container->getDefinition('doctrine.orm.default_configuration'); |
|
500 | $this->assertDICDefinitionMethodCallOnce( |
|
501 | $definition, |
|
502 | 'setEntityNamespaces', |
|
503 | [['YamlBundle' => 'Fixtures\Bundles\YamlBundle\Entity']] |
|
504 | ); |
|
505 | } |
|
506 | ||
@@ 544-569 (lines=26) @@ | ||
541 | ]); |
|
542 | } |
|
543 | ||
544 | public function testXmlBundleMappingDetection() |
|
545 | { |
|
546 | $container = $this->getContainer('XmlBundle'); |
|
547 | $extension = new DoctrineExtension(); |
|
548 | ||
549 | $config = BundleConfigurationBuilder::createBuilder() |
|
550 | ->addBaseConnection() |
|
551 | ->addEntityManager([ |
|
552 | 'default_entity_manager' => 'default', |
|
553 | 'entity_managers' => [ |
|
554 | 'default' => [ |
|
555 | 'mappings' => [ |
|
556 | 'XmlBundle' => [], |
|
557 | ], |
|
558 | ], |
|
559 | ], |
|
560 | ]) |
|
561 | ->build(); |
|
562 | $extension->load([$config], $container); |
|
563 | ||
564 | $definition = $container->getDefinition('doctrine.orm.default_metadata_driver'); |
|
565 | $this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', [ |
|
566 | new Reference('doctrine.orm.default_xml_metadata_driver'), |
|
567 | 'Fixtures\Bundles\XmlBundle\Entity', |
|
568 | ]); |
|
569 | } |
|
570 | ||
571 | public function testAnnotationsBundleMappingDetection() |
|
572 | { |
|
@@ 571-596 (lines=26) @@ | ||
568 | ]); |
|
569 | } |
|
570 | ||
571 | public function testAnnotationsBundleMappingDetection() |
|
572 | { |
|
573 | $container = $this->getContainer('AnnotationsBundle'); |
|
574 | $extension = new DoctrineExtension(); |
|
575 | ||
576 | $config = BundleConfigurationBuilder::createBuilder() |
|
577 | ->addBaseConnection() |
|
578 | ->addEntityManager([ |
|
579 | 'default_entity_manager' => 'default', |
|
580 | 'entity_managers' => [ |
|
581 | 'default' => [ |
|
582 | 'mappings' => [ |
|
583 | 'AnnotationsBundle' => [], |
|
584 | ], |
|
585 | ], |
|
586 | ], |
|
587 | ]) |
|
588 | ->build(); |
|
589 | $extension->load([$config], $container); |
|
590 | ||
591 | $definition = $container->getDefinition('doctrine.orm.default_metadata_driver'); |
|
592 | $this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', [ |
|
593 | new Reference('doctrine.orm.default_annotation_metadata_driver'), |
|
594 | 'Fixtures\Bundles\AnnotationsBundle\Entity', |
|
595 | ]); |
|
596 | } |
|
597 | ||
598 | public function testOrmMergeConfigs() |
|
599 | { |
|
@@ 507-522 (lines=16) @@ | ||
504 | ); |
|
505 | } |
|
506 | ||
507 | public function testOverwriteEntityAliases() |
|
508 | { |
|
509 | $container = $this->getContainer(); |
|
510 | $extension = new DoctrineExtension(); |
|
511 | ||
512 | $config = BundleConfigurationBuilder::createBuilder() |
|
513 | ->addBaseConnection() |
|
514 | ->build(); |
|
515 | $config['orm'] = ['default_entity_manager' => 'default', 'entity_managers' => ['default' => ['mappings' => ['YamlBundle' => ['alias' => 'yml']]]]]; |
|
516 | $extension->load([$config], $container); |
|
517 | ||
518 | $definition = $container->getDefinition('doctrine.orm.default_configuration'); |
|
519 | $this->assertDICDefinitionMethodCallOnce( |
|
520 | $definition, |
|
521 | 'setEntityNamespaces', |
|
522 | [['yml' => 'Fixtures\Bundles\YamlBundle\Entity']] |
|
523 | ); |
|
524 | } |
|
525 |