|
@@ 1024-1055 (lines=32) @@
|
| 1021 |
|
$this->assertEquals($expected, $actual); |
| 1022 |
|
} |
| 1023 |
|
|
| 1024 |
|
public function testCreateAssociationFromNavigationPropertyForwardRoleMismatch() |
| 1025 |
|
{ |
| 1026 |
|
$principalType = m::mock(TEntityTypeType::class); |
| 1027 |
|
$dependentType = m::mock(TEntityTypeType::class); |
| 1028 |
|
$principalNav = m::mock(TNavigationPropertyType::class); |
| 1029 |
|
$principalNav->shouldReceive('getRelationship')->andReturn('foo')->once(); |
| 1030 |
|
$principalNav->shouldReceive('getToRole')->andReturn('Forwards'); |
| 1031 |
|
$principalNav->shouldReceive('getFromRole')->andReturn('Reverse'); |
| 1032 |
|
$dependentNav = m::mock(TNavigationPropertyType::class); |
| 1033 |
|
$dependentNav->shouldReceive('getRelationship')->andReturn('foo')->once(); |
| 1034 |
|
$dependentNav->shouldReceive('getToRole')->andReturn('Reverse'); |
| 1035 |
|
$dependentNav->shouldReceive('getFromRole')->andReturn('Sideways'); |
| 1036 |
|
|
| 1037 |
|
$metadataManager = new MetadataManagerDummy(); |
| 1038 |
|
|
| 1039 |
|
$expected = "Principal to role should match dependent from role, and vice versa"; |
| 1040 |
|
$actual = null; |
| 1041 |
|
|
| 1042 |
|
try { |
| 1043 |
|
$metadataManager->createAssocationFromNavigationProperty( |
| 1044 |
|
$principalType, |
| 1045 |
|
$dependentType, |
| 1046 |
|
$principalNav, |
| 1047 |
|
$dependentNav, |
| 1048 |
|
"*", |
| 1049 |
|
"*" |
| 1050 |
|
); |
| 1051 |
|
} catch (\InvalidArgumentException $e) { |
| 1052 |
|
$actual = $e->getMessage(); |
| 1053 |
|
} |
| 1054 |
|
$this->assertEquals($expected, $actual); |
| 1055 |
|
} |
| 1056 |
|
|
| 1057 |
|
public function testCreateAssociationFromNavigationPropertyReverseRoleMismatch() |
| 1058 |
|
{ |
|
@@ 1057-1088 (lines=32) @@
|
| 1054 |
|
$this->assertEquals($expected, $actual); |
| 1055 |
|
} |
| 1056 |
|
|
| 1057 |
|
public function testCreateAssociationFromNavigationPropertyReverseRoleMismatch() |
| 1058 |
|
{ |
| 1059 |
|
$principalType = m::mock(TEntityTypeType::class); |
| 1060 |
|
$dependentType = m::mock(TEntityTypeType::class); |
| 1061 |
|
$principalNav = m::mock(TNavigationPropertyType::class); |
| 1062 |
|
$principalNav->shouldReceive('getRelationship')->andReturn('foo')->once(); |
| 1063 |
|
$principalNav->shouldReceive('getToRole')->andReturn('Forwards'); |
| 1064 |
|
$principalNav->shouldReceive('getFromRole')->andReturn('Reverse'); |
| 1065 |
|
$dependentNav = m::mock(TNavigationPropertyType::class); |
| 1066 |
|
$dependentNav->shouldReceive('getRelationship')->andReturn('foo')->once(); |
| 1067 |
|
$dependentNav->shouldReceive('getToRole')->andReturn('Sideways'); |
| 1068 |
|
$dependentNav->shouldReceive('getFromRole')->andReturn('Forwards'); |
| 1069 |
|
|
| 1070 |
|
$metadataManager = new MetadataManagerDummy(); |
| 1071 |
|
|
| 1072 |
|
$expected = "Principal to role should match dependent from role, and vice versa"; |
| 1073 |
|
$actual = null; |
| 1074 |
|
|
| 1075 |
|
try { |
| 1076 |
|
$metadataManager->createAssocationFromNavigationProperty( |
| 1077 |
|
$principalType, |
| 1078 |
|
$dependentType, |
| 1079 |
|
$principalNav, |
| 1080 |
|
$dependentNav, |
| 1081 |
|
"*", |
| 1082 |
|
"*" |
| 1083 |
|
); |
| 1084 |
|
} catch (\InvalidArgumentException $e) { |
| 1085 |
|
$actual = $e->getMessage(); |
| 1086 |
|
} |
| 1087 |
|
$this->assertEquals($expected, $actual); |
| 1088 |
|
} |
| 1089 |
|
|
| 1090 |
|
/** |
| 1091 |
|
* @return array |