Code Duplication    Length = 12-16 lines in 3 locations

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

@@ 805-818 (lines=14) @@
802
    /**
803
     * @group DDC-996
804
     */
805
    public function testEmptyFieldNameThrowsException()
806
    {
807
        $this->expectException(MappingException::class);
808
        $this->expectExceptionMessage("The field or association mapping misses the 'fieldName' attribute in entity '" . CMS\CmsUser::class . "'.");
809
810
        $cm = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext);
811
        $cm->setTable(new Mapping\TableMetadata('cms_users'));
812
813
        $fieldMetadata = new Mapping\FieldMetadata('');
814
815
        $fieldMetadata->setType(Type::getType('string'));
816
817
        $cm->addProperty($fieldMetadata);
818
    }
819
820
    public function testRetrievalOfNamedQueries()
821
    {
@@ 1193-1204 (lines=12) @@
1190
    /**
1191
     * @group DDC-659
1192
     */
1193
    public function testLifecycleCallbackNotFound()
1194
    {
1195
        $cm = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext);
1196
        $cm->setTable(new Mapping\TableMetadata('cms_users'));
1197
1198
        $cm->addLifecycleCallback('notfound', 'postLoad');
1199
1200
        $this->expectException(MappingException::class);
1201
        $this->expectExceptionMessage("Entity '" . CMS\CmsUser::class . "' has no method 'notfound' to be registered as lifecycle callback.");
1202
1203
        $cm->validateLifecycleCallbacks(new RuntimeReflectionService());
1204
    }
1205
1206
    /**
1207
     * @group ImproveErrorMessages
@@ 1209-1224 (lines=16) @@
1206
    /**
1207
     * @group ImproveErrorMessages
1208
     */
1209
    public function testTargetEntityNotFound()
1210
    {
1211
        $cm = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext);
1212
        $cm->setTable(new Mapping\TableMetadata('cms_users'));
1213
1214
        $association = new Mapping\ManyToOneAssociationMetadata('address');
1215
1216
        $association->setTargetEntity('UnknownClass');
1217
1218
        $cm->addProperty($association);
1219
1220
        $this->expectException(MappingException::class);
1221
        $this->expectExceptionMessage("The target-entity 'UnknownClass' cannot be found in '" . CMS\CmsUser::class . "#address'.");
1222
1223
        $cm->validateAssociations();
1224
    }
1225
1226
    /**
1227
     * @group DDC-1663