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