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