|
@@ 318-338 (lines=21) @@
|
| 315 |
|
$metadata->addProperty($property); |
| 316 |
|
} |
| 317 |
|
|
| 318 |
|
public function testGetSingleIdentifierFieldName_MultipleIdentifierEntity_ThrowsException() |
| 319 |
|
{ |
| 320 |
|
$metadata = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext); |
| 321 |
|
$metadata->initializeReflection(new RuntimeReflectionService()); |
| 322 |
|
|
| 323 |
|
$fieldMetadata = new Mapping\FieldMetadata('name'); |
| 324 |
|
$fieldMetadata->setType(Type::getType('string')); |
| 325 |
|
|
| 326 |
|
$metadata->addProperty($fieldMetadata); |
| 327 |
|
|
| 328 |
|
$fieldMetadata = new Mapping\FieldMetadata('username'); |
| 329 |
|
$fieldMetadata->setType(Type::getType('string')); |
| 330 |
|
|
| 331 |
|
$metadata->addProperty($fieldMetadata); |
| 332 |
|
|
| 333 |
|
$metadata->setIdentifier(['name', 'username']); |
| 334 |
|
|
| 335 |
|
$this->expectException(MappingException::class); |
| 336 |
|
|
| 337 |
|
$metadata->getSingleIdentifierFieldName(); |
| 338 |
|
} |
| 339 |
|
|
| 340 |
|
public function testGetSingleIdentifierFieldName_NoIdEntity_ThrowsException() |
| 341 |
|
{ |
|
@@ 376-395 (lines=20) @@
|
| 373 |
|
$cm->addInheritedProperty($association); |
| 374 |
|
} |
| 375 |
|
|
| 376 |
|
public function testDuplicateColumnName_ThrowsMappingException() |
| 377 |
|
{ |
| 378 |
|
$metadata = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext); |
| 379 |
|
$metadata->initializeReflection(new RuntimeReflectionService()); |
| 380 |
|
|
| 381 |
|
$fieldMetadata = new Mapping\FieldMetadata('name'); |
| 382 |
|
|
| 383 |
|
$fieldMetadata->setType(Type::getType('string')); |
| 384 |
|
|
| 385 |
|
$metadata->addProperty($fieldMetadata); |
| 386 |
|
|
| 387 |
|
$this->expectException(MappingException::class); |
| 388 |
|
|
| 389 |
|
$fieldMetadata = new Mapping\FieldMetadata('username'); |
| 390 |
|
|
| 391 |
|
$fieldMetadata->setType(Type::getType('string')); |
| 392 |
|
$fieldMetadata->setColumnName('name'); |
| 393 |
|
|
| 394 |
|
$metadata->addProperty($fieldMetadata); |
| 395 |
|
} |
| 396 |
|
|
| 397 |
|
public function testDuplicateColumnName_DiscriminatorColumn_ThrowsMappingException() |
| 398 |
|
{ |
|
@@ 397-417 (lines=21) @@
|
| 394 |
|
$metadata->addProperty($fieldMetadata); |
| 395 |
|
} |
| 396 |
|
|
| 397 |
|
public function testDuplicateColumnName_DiscriminatorColumn_ThrowsMappingException() |
| 398 |
|
{ |
| 399 |
|
$metadata = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext); |
| 400 |
|
$metadata->initializeReflection(new RuntimeReflectionService()); |
| 401 |
|
|
| 402 |
|
$fieldMetadata = new Mapping\FieldMetadata('name'); |
| 403 |
|
|
| 404 |
|
$fieldMetadata->setType(Type::getType('string')); |
| 405 |
|
|
| 406 |
|
$metadata->addProperty($fieldMetadata); |
| 407 |
|
|
| 408 |
|
$discrColumn = new DiscriminatorColumnMetadata(); |
| 409 |
|
|
| 410 |
|
$discrColumn->setColumnName('name'); |
| 411 |
|
$discrColumn->setType(Type::getType('string')); |
| 412 |
|
$discrColumn->setLength(255); |
| 413 |
|
|
| 414 |
|
$this->expectException(\Doctrine\ORM\Mapping\MappingException::class); |
| 415 |
|
|
| 416 |
|
$metadata->setDiscriminatorColumn($discrColumn); |
| 417 |
|
} |
| 418 |
|
|
| 419 |
|
public function testDuplicateColumnName_DiscriminatorColumn2_ThrowsMappingException() |
| 420 |
|
{ |
|
@@ 419-439 (lines=21) @@
|
| 416 |
|
$metadata->setDiscriminatorColumn($discrColumn); |
| 417 |
|
} |
| 418 |
|
|
| 419 |
|
public function testDuplicateColumnName_DiscriminatorColumn2_ThrowsMappingException() |
| 420 |
|
{ |
| 421 |
|
$metadata = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext); |
| 422 |
|
$metadata->initializeReflection(new RuntimeReflectionService()); |
| 423 |
|
|
| 424 |
|
$discrColumn = new DiscriminatorColumnMetadata(); |
| 425 |
|
|
| 426 |
|
$discrColumn->setColumnName('name'); |
| 427 |
|
$discrColumn->setType(Type::getType('string')); |
| 428 |
|
$discrColumn->setLength(255); |
| 429 |
|
|
| 430 |
|
$metadata->setDiscriminatorColumn($discrColumn); |
| 431 |
|
|
| 432 |
|
$this->expectException(\Doctrine\ORM\Mapping\MappingException::class); |
| 433 |
|
|
| 434 |
|
$fieldMetadata = new Mapping\FieldMetadata('name'); |
| 435 |
|
|
| 436 |
|
$fieldMetadata->setType(Type::getType('string')); |
| 437 |
|
|
| 438 |
|
$metadata->addProperty($fieldMetadata); |
| 439 |
|
} |
| 440 |
|
|
| 441 |
|
public function testDuplicateFieldAndAssociationMapping1_ThrowsException() |
| 442 |
|
{ |
|
@@ 679-696 (lines=18) @@
|
| 676 |
|
/** |
| 677 |
|
* @group DDC-886 |
| 678 |
|
*/ |
| 679 |
|
public function testSetMultipleIdentifierSetsComposite() |
| 680 |
|
{ |
| 681 |
|
$metadata = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext); |
| 682 |
|
$metadata->initializeReflection(new RuntimeReflectionService()); |
| 683 |
|
|
| 684 |
|
$fieldMetadata = new Mapping\FieldMetadata('name'); |
| 685 |
|
$fieldMetadata->setType(Type::getType('string')); |
| 686 |
|
|
| 687 |
|
$metadata->addProperty($fieldMetadata); |
| 688 |
|
|
| 689 |
|
$fieldMetadata = new Mapping\FieldMetadata('username'); |
| 690 |
|
$fieldMetadata->setType(Type::getType('string')); |
| 691 |
|
|
| 692 |
|
$metadata->addProperty($fieldMetadata); |
| 693 |
|
|
| 694 |
|
$metadata->setIdentifier(['name', 'username']); |
| 695 |
|
self::assertTrue($metadata->isIdentifierComposite()); |
| 696 |
|
} |
| 697 |
|
|
| 698 |
|
/** |
| 699 |
|
* @group DDC-961 |