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