Code Duplication    Length = 18-26 lines in 4 locations

Tests/DependencyInjection/DoctrineExtensionTest.php 4 locations

@@ 469-486 (lines=18) @@
466
        $this->assertEquals('YamlBundle\Cache\MyCacheFactory', $slcDefinition->getClass());
467
    }
468
469
    public function testBundleEntityAliases() : void
470
    {
471
        $container = $this->getContainer();
472
        $extension = new DoctrineExtension();
473
474
        $config        = BundleConfigurationBuilder::createBuilder()
475
             ->addBaseConnection()
476
             ->build();
477
        $config['orm'] = ['default_entity_manager' => 'default', 'entity_managers' => ['default' => ['mappings' => ['YamlBundle' => []]]]];
478
        $extension->load([$config], $container);
479
480
        $definition = $container->getDefinition('doctrine.orm.default_configuration');
481
        $this->assertDICDefinitionMethodCallOnce(
482
            $definition,
483
            'setEntityNamespaces',
484
            [['YamlBundle' => 'Fixtures\Bundles\YamlBundle\Entity']]
485
        );
486
    }
487
488
    public function testOverwriteEntityAliases() : void
489
    {
@@ 488-505 (lines=18) @@
485
        );
486
    }
487
488
    public function testOverwriteEntityAliases() : void
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' => ['alias' => 'yml']]]]];
497
        $extension->load([$config], $container);
498
499
        $definition = $container->getDefinition('doctrine.orm.default_configuration');
500
        $this->assertDICDefinitionMethodCallOnce(
501
            $definition,
502
            'setEntityNamespaces',
503
            [['yml' => 'Fixtures\Bundles\YamlBundle\Entity']]
504
        );
505
    }
506
507
    public function testYamlBundleMappingDetection() : void
508
    {
@@ 525-550 (lines=26) @@
522
        ]);
523
    }
524
525
    public function testXmlBundleMappingDetection() : void
526
    {
527
        $container = $this->getContainer('XmlBundle');
528
        $extension = new DoctrineExtension();
529
530
        $config = BundleConfigurationBuilder::createBuilder()
531
            ->addBaseConnection()
532
            ->addEntityManager([
533
                'default_entity_manager' => 'default',
534
                'entity_managers' => [
535
                    'default' => [
536
                        'mappings' => [
537
                            'XmlBundle' => [],
538
                        ],
539
                    ],
540
                ],
541
            ])
542
            ->build();
543
        $extension->load([$config], $container);
544
545
        $definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
546
        $this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', [
547
            new Reference('doctrine.orm.default_xml_metadata_driver'),
548
            'Fixtures\Bundles\XmlBundle\Entity',
549
        ]);
550
    }
551
552
    public function testAnnotationsBundleMappingDetection() : void
553
    {
@@ 552-577 (lines=26) @@
549
        ]);
550
    }
551
552
    public function testAnnotationsBundleMappingDetection() : void
553
    {
554
        $container = $this->getContainer('AnnotationsBundle');
555
        $extension = new DoctrineExtension();
556
557
        $config = BundleConfigurationBuilder::createBuilder()
558
            ->addBaseConnection()
559
            ->addEntityManager([
560
                'default_entity_manager' => 'default',
561
                'entity_managers' => [
562
                    'default' => [
563
                        'mappings' => [
564
                            'AnnotationsBundle' => [],
565
                        ],
566
                    ],
567
                ],
568
            ])
569
            ->build();
570
        $extension->load([$config], $container);
571
572
        $definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
573
        $this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', [
574
            new Reference('doctrine.orm.default_annotation_metadata_driver'),
575
            'Fixtures\Bundles\AnnotationsBundle\Entity',
576
        ]);
577
    }
578
579
    public function testOrmMergeConfigs() : void
580
    {