| @@ 527-547 (lines=21) @@ | ||
| 524 | $this->assertNull($result->getDocumentation()); |
|
| 525 | } |
|
| 526 | ||
| 527 | public function testMalformedMultiplicity() |
|
| 528 | { |
|
| 529 | list(, $metadataManager, $CategoryType, $CustomerType) = $this->setUpMetadataForNavTests(); |
|
| 530 | ||
| 531 | $expected = "Malformed multiplicity - valid values are *, 0..1 and 1"; |
|
| 532 | $actual = null; |
|
| 533 | ||
| 534 | try { |
|
| 535 | $metadataManager->addNavigationPropertyToEntityType( |
|
| 536 | $CategoryType, |
|
| 537 | "1", |
|
| 538 | "Customers", |
|
| 539 | $CustomerType, |
|
| 540 | "ABC", |
|
| 541 | "Categories" |
|
| 542 | ); |
|
| 543 | } catch (\InvalidArgumentException $e) { |
|
| 544 | $actual = $e->getMessage(); |
|
| 545 | } |
|
| 546 | $this->assertEquals($expected, $actual); |
|
| 547 | } |
|
| 548 | ||
| 549 | public function testInvalidMultiplicityBelongsOnBothEnds() |
|
| 550 | { |
|
| @@ 549-569 (lines=21) @@ | ||
| 546 | $this->assertEquals($expected, $actual); |
|
| 547 | } |
|
| 548 | ||
| 549 | public function testInvalidMultiplicityBelongsOnBothEnds() |
|
| 550 | { |
|
| 551 | list(, $metadataManager, $CategoryType, $CustomerType) = $this->setUpMetadataForNavTests(); |
|
| 552 | ||
| 553 | $expected = "Invalid multiplicity combination - 1 1"; |
|
| 554 | $actual = null; |
|
| 555 | ||
| 556 | try { |
|
| 557 | $metadataManager->addNavigationPropertyToEntityType( |
|
| 558 | $CategoryType, |
|
| 559 | "1", |
|
| 560 | "Customers", |
|
| 561 | $CustomerType, |
|
| 562 | "1", |
|
| 563 | "Categories" |
|
| 564 | ); |
|
| 565 | } catch (\InvalidArgumentException $e) { |
|
| 566 | $actual = $e->getMessage(); |
|
| 567 | } |
|
| 568 | $this->assertEquals($expected, $actual); |
|
| 569 | } |
|
| 570 | ||
| 571 | public function testInvalidMultiplicityManyToHasMany() |
|
| 572 | { |
|
| @@ 571-591 (lines=21) @@ | ||
| 568 | $this->assertEquals($expected, $actual); |
|
| 569 | } |
|
| 570 | ||
| 571 | public function testInvalidMultiplicityManyToHasMany() |
|
| 572 | { |
|
| 573 | list(, $metadataManager, $CategoryType, $CustomerType) = $this->setUpMetadataForNavTests(); |
|
| 574 | ||
| 575 | $expected = "Invalid multiplicity combination - * 0..1"; |
|
| 576 | $actual = null; |
|
| 577 | ||
| 578 | try { |
|
| 579 | $metadataManager->addNavigationPropertyToEntityType( |
|
| 580 | $CategoryType, |
|
| 581 | "*", |
|
| 582 | "Customers", |
|
| 583 | $CustomerType, |
|
| 584 | "0..1", |
|
| 585 | "Categories" |
|
| 586 | ); |
|
| 587 | } catch (\InvalidArgumentException $e) { |
|
| 588 | $actual = $e->getMessage(); |
|
| 589 | } |
|
| 590 | $this->assertEquals($expected, $actual); |
|
| 591 | } |
|
| 592 | ||
| 593 | public function testAddComplexType() |
|
| 594 | { |
|