Code Duplication    Length = 25-25 lines in 3 locations

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

@@ 780-804 (lines=25) @@
777
     /**
778
     * @group DDC-2172
779
     */
780
    public function testGetInheritanceTypeString()
781
    {
782
        $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadata');
783
        $method     = new \ReflectionMethod($this->generator, 'getInheritanceTypeString');
784
        $constants  = $reflection->getConstants();
785
        $pattern    = '/^InheritanceType::/';
786
787
        $method->setAccessible(true);
788
789
        foreach ($constants as $name => $value) {
790
            if( ! preg_match($pattern, $name)) {
791
                continue;
792
            }
793
794
            $expected = preg_replace($pattern, '', $name);
795
            $actual   = $method->invoke($this->generator, $value);
796
797
            self::assertEquals($expected, $actual);
798
        }
799
800
        $this->expectException(\InvalidArgumentException::class);
801
        $this->expectExceptionMessage('Invalid provided InheritanceType: INVALID');
802
803
        $method->invoke($this->generator, 'INVALID');
804
    }
805
806
    /**
807
    * @group DDC-2172
@@ 809-833 (lines=25) @@
806
    /**
807
    * @group DDC-2172
808
    */
809
    public function testGetChangeTrackingPolicyString()
810
    {
811
        $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadata');
812
        $method     = new \ReflectionMethod($this->generator, 'getChangeTrackingPolicyString');
813
        $constants  = $reflection->getConstants();
814
        $pattern    = '/^ChangeTrackingPolicy::/';
815
816
        $method->setAccessible(true);
817
818
        foreach ($constants as $name => $value) {
819
            if( ! preg_match($pattern, $name)) {
820
                continue;
821
            }
822
823
            $expected = preg_replace($pattern, '', $name);
824
            $actual   = $method->invoke($this->generator, $value);
825
826
            self::assertEquals($expected, $actual);
827
        }
828
829
        $this->expectException(\InvalidArgumentException::class);
830
        $this->expectExceptionMessage('Invalid provided ChangeTrackingPolicy: INVALID');
831
832
        $method->invoke($this->generator, 'INVALID');
833
    }
834
835
    /**
836
     * @group DDC-2172
@@ 838-862 (lines=25) @@
835
    /**
836
     * @group DDC-2172
837
     */
838
    public function testGetIdGeneratorTypeString()
839
    {
840
        $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadata');
841
        $method     = new \ReflectionMethod($this->generator, 'getIdGeneratorTypeString');
842
        $constants  = $reflection->getConstants();
843
        $pattern    = '/^GeneratorType::/';
844
845
        $method->setAccessible(true);
846
847
        foreach ($constants as $name => $value) {
848
            if( ! preg_match($pattern, $name)) {
849
                continue;
850
            }
851
852
            $expected = preg_replace($pattern, '', $name);
853
            $actual   = $method->invoke($this->generator, $value);
854
855
            self::assertEquals($expected, $actual);
856
        }
857
858
        $this->expectException(\InvalidArgumentException::class);
859
        $this->expectExceptionMessage('Invalid provided IdGeneratorType: INVALID');
860
861
        $method->invoke($this->generator, 'INVALID');
862
    }
863
864
    /**
865
     * @dataProvider getEntityTypeAliasDataProvider