| @@ 479-499 (lines=21) @@ | ||
| 476 | $this->assertTrue($result->isOK($msg)); |
|
| 477 | } |
|
| 478 | ||
| 479 | public function testMalformedMultiplicity() |
|
| 480 | { |
|
| 481 | list(, $metadataManager, $CategoryType, $CustomerType) = $this->setUpMetadataForNavTests(); |
|
| 482 | ||
| 483 | $expected = "Malformed multiplicity - valid values are *, 0..1 and 1"; |
|
| 484 | $actual = null; |
|
| 485 | ||
| 486 | try { |
|
| 487 | $metadataManager->addNavigationPropertyToEntityType( |
|
| 488 | $CategoryType, |
|
| 489 | "1", |
|
| 490 | "Customers", |
|
| 491 | $CustomerType, |
|
| 492 | "ABC", |
|
| 493 | "Categories" |
|
| 494 | ); |
|
| 495 | } catch (\InvalidArgumentException $e) { |
|
| 496 | $actual = $e->getMessage(); |
|
| 497 | } |
|
| 498 | $this->assertEquals($expected, $actual); |
|
| 499 | } |
|
| 500 | ||
| 501 | public function testInvalidMultiplicityBelongsOnBothEnds() |
|
| 502 | { |
|
| @@ 501-521 (lines=21) @@ | ||
| 498 | $this->assertEquals($expected, $actual); |
|
| 499 | } |
|
| 500 | ||
| 501 | public function testInvalidMultiplicityBelongsOnBothEnds() |
|
| 502 | { |
|
| 503 | list(, $metadataManager, $CategoryType, $CustomerType) = $this->setUpMetadataForNavTests(); |
|
| 504 | ||
| 505 | $expected = "Invalid multiplicity combination - 1 1"; |
|
| 506 | $actual = null; |
|
| 507 | ||
| 508 | try { |
|
| 509 | $metadataManager->addNavigationPropertyToEntityType( |
|
| 510 | $CategoryType, |
|
| 511 | "1", |
|
| 512 | "Customers", |
|
| 513 | $CustomerType, |
|
| 514 | "1", |
|
| 515 | "Categories" |
|
| 516 | ); |
|
| 517 | } catch (\InvalidArgumentException $e) { |
|
| 518 | $actual = $e->getMessage(); |
|
| 519 | } |
|
| 520 | $this->assertEquals($expected, $actual); |
|
| 521 | } |
|
| 522 | ||
| 523 | public function testInvalidMultiplicityManyToHasMany() |
|
| 524 | { |
|
| @@ 523-543 (lines=21) @@ | ||
| 520 | $this->assertEquals($expected, $actual); |
|
| 521 | } |
|
| 522 | ||
| 523 | public function testInvalidMultiplicityManyToHasMany() |
|
| 524 | { |
|
| 525 | list(, $metadataManager, $CategoryType, $CustomerType) = $this->setUpMetadataForNavTests(); |
|
| 526 | ||
| 527 | $expected = "Invalid multiplicity combination - * 0..1"; |
|
| 528 | $actual = null; |
|
| 529 | ||
| 530 | try { |
|
| 531 | $metadataManager->addNavigationPropertyToEntityType( |
|
| 532 | $CategoryType, |
|
| 533 | "*", |
|
| 534 | "Customers", |
|
| 535 | $CustomerType, |
|
| 536 | "0..1", |
|
| 537 | "Categories" |
|
| 538 | ); |
|
| 539 | } catch (\InvalidArgumentException $e) { |
|
| 540 | $actual = $e->getMessage(); |
|
| 541 | } |
|
| 542 | $this->assertEquals($expected, $actual); |
|
| 543 | } |
|
| 544 | ||
| 545 | /** |
|
| 546 | * @return array |
|