@@ 1067-1098 (lines=32) @@ | ||
1064 | $this->assertEquals($expected, $actual); |
|
1065 | } |
|
1066 | ||
1067 | public function testCreateAssociationFromNavigationPropertyForwardRoleMismatch() |
|
1068 | { |
|
1069 | $principalType = m::mock(TEntityTypeType::class); |
|
1070 | $dependentType = m::mock(TEntityTypeType::class); |
|
1071 | $principalNav = m::mock(TNavigationPropertyType::class); |
|
1072 | $principalNav->shouldReceive('getRelationship')->andReturn('foo')->once(); |
|
1073 | $principalNav->shouldReceive('getToRole')->andReturn('Forwards'); |
|
1074 | $principalNav->shouldReceive('getFromRole')->andReturn('Reverse'); |
|
1075 | $dependentNav = m::mock(TNavigationPropertyType::class); |
|
1076 | $dependentNav->shouldReceive('getRelationship')->andReturn('foo')->once(); |
|
1077 | $dependentNav->shouldReceive('getToRole')->andReturn('Reverse'); |
|
1078 | $dependentNav->shouldReceive('getFromRole')->andReturn('Sideways'); |
|
1079 | ||
1080 | $metadataManager = new MetadataManagerDummy(); |
|
1081 | ||
1082 | $expected = 'Principal to role should match dependent from role, and vice versa'; |
|
1083 | $actual = null; |
|
1084 | ||
1085 | try { |
|
1086 | $metadataManager->createAssocationFromNavigationProperty( |
|
1087 | $principalType, |
|
1088 | $dependentType, |
|
1089 | $principalNav, |
|
1090 | $dependentNav, |
|
1091 | '*', |
|
1092 | '*' |
|
1093 | ); |
|
1094 | } catch (\InvalidArgumentException $e) { |
|
1095 | $actual = $e->getMessage(); |
|
1096 | } |
|
1097 | $this->assertEquals($expected, $actual); |
|
1098 | } |
|
1099 | ||
1100 | public function testCreateAssociationFromNavigationPropertyReverseRoleMismatch() |
|
1101 | { |
|
@@ 1100-1131 (lines=32) @@ | ||
1097 | $this->assertEquals($expected, $actual); |
|
1098 | } |
|
1099 | ||
1100 | public function testCreateAssociationFromNavigationPropertyReverseRoleMismatch() |
|
1101 | { |
|
1102 | $principalType = m::mock(TEntityTypeType::class); |
|
1103 | $dependentType = m::mock(TEntityTypeType::class); |
|
1104 | $principalNav = m::mock(TNavigationPropertyType::class); |
|
1105 | $principalNav->shouldReceive('getRelationship')->andReturn('foo')->once(); |
|
1106 | $principalNav->shouldReceive('getToRole')->andReturn('Forwards'); |
|
1107 | $principalNav->shouldReceive('getFromRole')->andReturn('Reverse'); |
|
1108 | $dependentNav = m::mock(TNavigationPropertyType::class); |
|
1109 | $dependentNav->shouldReceive('getRelationship')->andReturn('foo')->once(); |
|
1110 | $dependentNav->shouldReceive('getToRole')->andReturn('Sideways'); |
|
1111 | $dependentNav->shouldReceive('getFromRole')->andReturn('Forwards'); |
|
1112 | ||
1113 | $metadataManager = new MetadataManagerDummy(); |
|
1114 | ||
1115 | $expected = 'Principal to role should match dependent from role, and vice versa'; |
|
1116 | $actual = null; |
|
1117 | ||
1118 | try { |
|
1119 | $metadataManager->createAssocationFromNavigationProperty( |
|
1120 | $principalType, |
|
1121 | $dependentType, |
|
1122 | $principalNav, |
|
1123 | $dependentNav, |
|
1124 | '*', |
|
1125 | '*' |
|
1126 | ); |
|
1127 | } catch (\InvalidArgumentException $e) { |
|
1128 | $actual = $e->getMessage(); |
|
1129 | } |
|
1130 | $this->assertEquals($expected, $actual); |
|
1131 | } |
|
1132 | ||
1133 | /** |
|
1134 | * @return array |