Code Duplication    Length = 32-32 lines in 2 locations

tests/MetadataManagerTest.php 2 locations

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