Code Duplication    Length = 15-16 lines in 3 locations

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

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