Code Duplication    Length = 22-22 lines in 2 locations

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

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