Code Duplication    Length = 15-16 lines in 3 locations

tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php 3 locations

@@ 738-753 (lines=16) @@
735
    /**
736
     * @group DDC-117
737
     */
738
    public function testOrphanRemovalIdentifierAssociation()
739
    {
740
        $cm = new ClassMetadata(DDC117ArticleDetails::class, $this->metadataBuildingContext);
741
        $cm->initializeReflection(new RuntimeReflectionService());
742
743
        $this->expectException(MappingException::class);
744
        $this->expectExceptionMessage('The orphan removal option is not allowed on an association that');
745
746
        $association = new Mapping\OneToOneAssociationMetadata('article');
747
748
        $association->setTargetEntity(DDC117Article::class);
749
        $association->setPrimaryKey(true);
750
        $association->setOrphanRemoval(true);
751
752
        $cm->addProperty($association);
753
    }
754
755
    /**
756
     * @group DDC-117
@@ 758-773 (lines=16) @@
755
    /**
756
     * @group DDC-117
757
     */
758
    public function testInverseIdentifierAssociation()
759
    {
760
        $cm = new ClassMetadata(DDC117ArticleDetails::class, $this->metadataBuildingContext);
761
        $cm->initializeReflection(new RuntimeReflectionService());
762
763
        $this->expectException(MappingException::class);
764
        $this->expectExceptionMessage('An inverse association is not allowed to be identifier in');
765
766
        $association = new Mapping\OneToOneAssociationMetadata('article');
767
768
        $association->setTargetEntity(DDC117Article::class);
769
        $association->setPrimaryKey(true);
770
        $association->setMappedBy('details');
771
772
        $cm->addProperty($association);
773
    }
774
775
    /**
776
     * @group DDC-117
@@ 778-792 (lines=15) @@
775
    /**
776
     * @group DDC-117
777
     */
778
    public function testIdentifierAssociationManyToMany()
779
    {
780
        $cm = new ClassMetadata(DDC117ArticleDetails::class, $this->metadataBuildingContext);
781
        $cm->initializeReflection(new RuntimeReflectionService());
782
783
        $this->expectException(MappingException::class);
784
        $this->expectExceptionMessage('Many-to-many or one-to-many associations are not allowed to be identifier in');
785
786
        $association = new Mapping\ManyToManyAssociationMetadata('article');
787
788
        $association->setTargetEntity(DDC117Article::class);
789
        $association->setPrimaryKey(true);
790
791
        $cm->addProperty($association);
792
    }
793
794
    /**
795
     * @group DDC-996