Code Duplication    Length = 22-22 lines in 2 locations

tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php 2 locations

@@ 756-777 (lines=22) @@
753
    /**
754
     * @group DDC-2372
755
     */
756
    public function testTraitPropertiesAndMethodsAreNotDuplicated()
757
    {
758
        $cmf = new ClassMetadataFactory();
759
        $em = $this->_getTestEntityManager();
760
        $cmf->setEntityManager($em);
761
762
        $user = new DDC2372User();
763
        $metadata = $cmf->getMetadataFor(get_class($user));
764
        $metadata->name = $this->_namespace . "\DDC2372User";
765
        $metadata->namespace = $this->_namespace;
766
767
        $this->_generator->writeEntityClass($metadata, $this->_tmpDir);
768
769
        $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php");
770
        require $this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php";
771
772
        $reflClass = new \ReflectionClass($metadata->name);
773
774
        $this->assertSame($reflClass->hasProperty('address'), false);
775
        $this->assertSame($reflClass->hasMethod('setAddress'), false);
776
        $this->assertSame($reflClass->hasMethod('getAddress'), false);
777
    }
778
779
    /**
780
     * @group DDC-2372
@@ 782-803 (lines=22) @@
779
    /**
780
     * @group DDC-2372
781
     */
782
    public function testTraitPropertiesAndMethodsAreNotDuplicatedInChildClasses()
783
    {
784
        $cmf = new ClassMetadataFactory();
785
        $em = $this->_getTestEntityManager();
786
        $cmf->setEntityManager($em);
787
788
        $user = new DDC2372Admin();
789
        $metadata = $cmf->getMetadataFor(get_class($user));
790
        $metadata->name = $this->_namespace . "\DDC2372Admin";
791
        $metadata->namespace = $this->_namespace;
792
793
        $this->_generator->writeEntityClass($metadata, $this->_tmpDir);
794
795
        $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/DDC2372Admin.php");
796
        require $this->_tmpDir . "/" . $this->_namespace . "/DDC2372Admin.php";
797
798
        $reflClass = new \ReflectionClass($metadata->name);
799
800
        $this->assertSame($reflClass->hasProperty('address'), false);
801
        $this->assertSame($reflClass->hasMethod('setAddress'), false);
802
        $this->assertSame($reflClass->hasMethod('getAddress'), false);
803
    }
804
805
    /**
806
     * @group DDC-1590