Code Duplication    Length = 11-16 lines in 3 locations

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

@@ 797-810 (lines=14) @@
794
    /**
795
     * @group DDC-996
796
     */
797
    public function testEmptyFieldNameThrowsException()
798
    {
799
        $this->expectException(MappingException::class);
800
        $this->expectExceptionMessage("The field or association mapping misses the 'fieldName' attribute in entity '" . CMS\CmsUser::class . "'.");
801
802
        $metadata = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext);
803
        $metadata->initializeReflection(new RuntimeReflectionService());
804
805
        $fieldMetadata = new Mapping\FieldMetadata('');
806
807
        $fieldMetadata->setType(Type::getType('string'));
808
809
        $metadata->addProperty($fieldMetadata);
810
    }
811
812
    public function testRetrievalOfNamedQueries()
813
    {
@@ 1142-1152 (lines=11) @@
1139
    /**
1140
     * @group DDC-659
1141
     */
1142
    public function testLifecycleCallbackNotFound()
1143
    {
1144
        $cm = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext);
1145
        $cm->initializeReflection(new RuntimeReflectionService());
1146
        $cm->addLifecycleCallback('notfound', 'postLoad');
1147
1148
        $this->expectException(MappingException::class);
1149
        $this->expectExceptionMessage("Entity '" . CMS\CmsUser::class . "' has no method 'notfound' to be registered as lifecycle callback.");
1150
1151
        $cm->validateLifecycleCallbacks(new RuntimeReflectionService());
1152
    }
1153
1154
    /**
1155
     * @group ImproveErrorMessages
@@ 1157-1172 (lines=16) @@
1154
    /**
1155
     * @group ImproveErrorMessages
1156
     */
1157
    public function testTargetEntityNotFound()
1158
    {
1159
        $cm = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext);
1160
        $cm->initializeReflection(new RuntimeReflectionService());
1161
1162
        $association = new Mapping\ManyToOneAssociationMetadata('address');
1163
1164
        $association->setTargetEntity('UnknownClass');
1165
1166
        $cm->addProperty($association);
1167
1168
        $this->expectException(MappingException::class);
1169
        $this->expectExceptionMessage("The target-entity 'UnknownClass' cannot be found in '" . CMS\CmsUser::class . "#address'.");
1170
1171
        $cm->validateAssociations();
1172
    }
1173
1174
    /**
1175
     * @group DDC-1663