| @@ 60-76 (lines=17) @@ | ||
| 57 | $this->assertFalse($foo->issetOnDelete(1)); |
|
| 58 | } |
|
| 59 | ||
| 60 | public function testSetOnDeleteBadItem() |
|
| 61 | { |
|
| 62 | $expected = ''; |
|
| 63 | $actual = null; |
|
| 64 | ||
| 65 | $foo = new TAssociationEndType(); |
|
| 66 | $onDelete = m::mock(TOnActionType::class)->makePartial(); |
|
| 67 | $onDelete->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 68 | $delete = [$onDelete]; |
|
| 69 | ||
| 70 | try { |
|
| 71 | $foo->setOnDelete($delete); |
|
| 72 | } catch (\InvalidArgumentException $e) { |
|
| 73 | $actual = $e->getMessage(); |
|
| 74 | } |
|
| 75 | $this->assertEquals($expected, $actual); |
|
| 76 | } |
|
| 77 | ||
| 78 | public function testIsTOperationsOKBadData() |
|
| 79 | { |
|
| @@ 78-92 (lines=15) @@ | ||
| 75 | $this->assertEquals($expected, $actual); |
|
| 76 | } |
|
| 77 | ||
| 78 | public function testIsTOperationsOKBadData() |
|
| 79 | { |
|
| 80 | $expected = ''; |
|
| 81 | $actual = null; |
|
| 82 | ||
| 83 | $foo = new TAssociationEndType(); |
|
| 84 | $onDelete = m::mock(TOnActionType::class)->makePartial(); |
|
| 85 | $onDelete->shouldReceive('isOK')->andReturn(true, false)->twice(); |
|
| 86 | $delete = [$onDelete]; |
|
| 87 | ||
| 88 | $foo->setOnDelete($delete); |
|
| 89 | ||
| 90 | $this->assertFalse($foo->isTOperationsOK($actual)); |
|
| 91 | $this->assertEquals($expected, $actual); |
|
| 92 | } |
|
| 93 | } |
|
| 94 | ||
| @@ 36-47 (lines=12) @@ | ||
| 33 | $this->assertEquals($expected, $actual); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function testIsExtensibilityElementOKNoGoodnik() |
|
| 37 | { |
|
| 38 | $expected = ''; |
|
| 39 | $actual = null; |
|
| 40 | $foo = new TEnumTypeMemberType(); |
|
| 41 | $documentation = m::mock(TDocumentationType::class); |
|
| 42 | $documentation->shouldReceive('isOK')->andReturn(true, false)->twice(); |
|
| 43 | ||
| 44 | $foo->setDocumentation($documentation); |
|
| 45 | $this->assertFalse($foo->isExtensibilityElementOK($actual)); |
|
| 46 | $this->assertEquals($expected, $actual); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| @@ 105-120 (lines=16) @@ | ||
| 102 | $this->assertEquals($expected, $actual); |
|
| 103 | } |
|
| 104 | ||
| 105 | public function testTryToAddBadSchema() |
|
| 106 | { |
|
| 107 | $expected = ''; |
|
| 108 | $actual = null; |
|
| 109 | ||
| 110 | $schema = m::mock(Schema::class); |
|
| 111 | $schema->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 112 | ||
| 113 | $foo = new TDataServicesType(); |
|
| 114 | try { |
|
| 115 | $foo->addToSchema($schema); |
|
| 116 | } catch (\InvalidArgumentException $e) { |
|
| 117 | $actual = $e->getMessage(); |
|
| 118 | } |
|
| 119 | $this->assertEquals($expected, $actual); |
|
| 120 | } |
|
| 121 | ||
| 122 | ||
| 123 | public function testCheckSchemaExists() |
|
| @@ 147-158 (lines=12) @@ | ||
| 144 | $this->assertEquals($expected, $actual); |
|
| 145 | } |
|
| 146 | ||
| 147 | public function testIsOKWhenSchemaNotOk() |
|
| 148 | { |
|
| 149 | $expected = ''; |
|
| 150 | $actual = null; |
|
| 151 | ||
| 152 | $schema = m::mock(Schema::class); |
|
| 153 | $schema->shouldReceive('isOK')->andReturn(true, false)->twice(); |
|
| 154 | $foo = new TDataServicesType(); |
|
| 155 | $foo->addToSchema($schema); |
|
| 156 | $this->assertFalse($foo->isOK($actual)); |
|
| 157 | $this->assertEquals($expected, $actual); |
|
| 158 | } |
|
| 159 | } |
|
| 160 | ||
| @@ 30-45 (lines=16) @@ | ||
| 27 | $this->assertEquals($expected, $actual); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function testSetDataServiceTypeNotOK() |
|
| 31 | { |
|
| 32 | $dataServiceType = m::mock(TDataServicesType::class); |
|
| 33 | $dataServiceType->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 34 | $foo = new TEdmxType(); |
|
| 35 | ||
| 36 | $expected = ''; |
|
| 37 | $actual = null; |
|
| 38 | ||
| 39 | try { |
|
| 40 | $foo->setDataServiceType($dataServiceType); |
|
| 41 | } catch (\InvalidArgumentException $e) { |
|
| 42 | $actual = $e->getMessage(); |
|
| 43 | } |
|
| 44 | $this->assertEquals($expected, $actual); |
|
| 45 | } |
|
| 46 | ||
| 47 | public function testSetDesignerTypeNotOK() |
|
| 48 | { |
|
| @@ 47-62 (lines=16) @@ | ||
| 44 | $this->assertEquals($expected, $actual); |
|
| 45 | } |
|
| 46 | ||
| 47 | public function testSetDesignerTypeNotOK() |
|
| 48 | { |
|
| 49 | $designer = m::mock(TDesignerType::class); |
|
| 50 | $designer->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 51 | $foo = new TEdmxType(); |
|
| 52 | ||
| 53 | $expected = ''; |
|
| 54 | $actual = null; |
|
| 55 | ||
| 56 | try { |
|
| 57 | $foo->setDesigner($designer); |
|
| 58 | } catch (\InvalidArgumentException $e) { |
|
| 59 | $actual = $e->getMessage(); |
|
| 60 | } |
|
| 61 | $this->assertEquals($expected, $actual); |
|
| 62 | } |
|
| 63 | ||
| 64 | public function testSetDesignerTypeOK() |
|
| 65 | { |
|
| @@ 74-89 (lines=16) @@ | ||
| 71 | $this->assertTrue($foo->getDesigner()->isOK()); |
|
| 72 | } |
|
| 73 | ||
| 74 | public function testSetRuntimeNotOK() |
|
| 75 | { |
|
| 76 | $runtime = m::mock(TRuntimeType::class); |
|
| 77 | $runtime->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 78 | $foo = new TEdmxType(); |
|
| 79 | ||
| 80 | $expected = ''; |
|
| 81 | $actual = null; |
|
| 82 | ||
| 83 | try { |
|
| 84 | $foo->setRuntime($runtime); |
|
| 85 | } catch (\InvalidArgumentException $e) { |
|
| 86 | $actual = $e->getMessage(); |
|
| 87 | } |
|
| 88 | $this->assertEquals($expected, $actual); |
|
| 89 | } |
|
| 90 | ||
| 91 | public function testSetRuntimeOK() |
|
| 92 | { |
|
| @@ 122-134 (lines=13) @@ | ||
| 119 | $this->assertEquals($expected, $actual); |
|
| 120 | } |
|
| 121 | ||
| 122 | public function testIsObjectWithBadDataServiceOK() |
|
| 123 | { |
|
| 124 | $unwanted2 = 'Version cannot be null or empty'; |
|
| 125 | $actual = null; |
|
| 126 | $dataServiceType = m::mock(TDataServicesType::class); |
|
| 127 | $dataServiceType->shouldReceive('isOK')->andReturn(true, false)->twice(); |
|
| 128 | $foo = new TEdmxType(); |
|
| 129 | $foo->setVersion('1.5'); |
|
| 130 | $foo->setDataServiceType($dataServiceType); |
|
| 131 | ||
| 132 | $this->assertFalse($foo->isOK($actual)); |
|
| 133 | $this->assertNotEquals($unwanted2, $actual); |
|
| 134 | } |
|
| 135 | ||
| 136 | ||
| 137 | public function testIsObjectWithBadDesignerServiceOK() |
|
| @@ 42-58 (lines=17) @@ | ||
| 39 | $this->assertEquals($expected, $actual); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function testAddBadEnd() |
|
| 43 | { |
|
| 44 | $expected = ''; |
|
| 45 | $actual = null; |
|
| 46 | ||
| 47 | $end = m::mock(EndAnonymousType::class); |
|
| 48 | $end->shouldReceive('isOK')->andReturn(false); |
|
| 49 | ||
| 50 | $foo = new AssociationSetAnonymousType(); |
|
| 51 | ||
| 52 | try { |
|
| 53 | $foo->addToEnd($end); |
|
| 54 | } catch (\InvalidArgumentException $e) { |
|
| 55 | $actual = $e->getMessage(); |
|
| 56 | } |
|
| 57 | $this->assertEquals($expected, $actual); |
|
| 58 | } |
|
| 59 | ||
| 60 | public function testSetBadEnd() |
|
| 61 | { |
|
| @@ 60-76 (lines=17) @@ | ||
| 57 | $this->assertEquals($expected, $actual); |
|
| 58 | } |
|
| 59 | ||
| 60 | public function testSetBadEnd() |
|
| 61 | { |
|
| 62 | $expected = ''; |
|
| 63 | $actual = null; |
|
| 64 | ||
| 65 | $end = m::mock(EndAnonymousType::class); |
|
| 66 | $end->shouldReceive('isOK')->andReturn(false); |
|
| 67 | ||
| 68 | $foo = new AssociationSetAnonymousType(); |
|
| 69 | ||
| 70 | try { |
|
| 71 | $foo->setEnd([$end]); |
|
| 72 | } catch (\InvalidArgumentException $e) { |
|
| 73 | $actual = $e->getMessage(); |
|
| 74 | } |
|
| 75 | $this->assertEquals($expected, $actual); |
|
| 76 | } |
|
| 77 | ||
| 78 | public function testAddGoodEnd() |
|
| 79 | { |
|
| @@ 110-126 (lines=17) @@ | ||
| 107 | $this->assertStringEndsWith($expectedEnds, $actual); |
|
| 108 | } |
|
| 109 | ||
| 110 | public function testSetBadTypeAnnotation() |
|
| 111 | { |
|
| 112 | $expected = ''; |
|
| 113 | $actual = null; |
|
| 114 | ||
| 115 | $type = m::mock(TTypeAnnotationType::class)->makePartial(); |
|
| 116 | $type->shouldReceive('isOK')->andReturn(false); |
|
| 117 | ||
| 118 | $foo = new EntitySetAnonymousType(); |
|
| 119 | ||
| 120 | try { |
|
| 121 | $foo->setTypeAnnotation([$type]); |
|
| 122 | } catch (\InvalidArgumentException $e) { |
|
| 123 | $actual = $e->getMessage(); |
|
| 124 | } |
|
| 125 | $this->assertEquals($expected, $actual); |
|
| 126 | } |
|
| 127 | ||
| 128 | public function testAddBadTypeAnnotation() |
|
| 129 | { |
|
| @@ 128-144 (lines=17) @@ | ||
| 125 | $this->assertEquals($expected, $actual); |
|
| 126 | } |
|
| 127 | ||
| 128 | public function testAddBadTypeAnnotation() |
|
| 129 | { |
|
| 130 | $expected = ''; |
|
| 131 | $actual = null; |
|
| 132 | ||
| 133 | $type = m::mock(TTypeAnnotationType::class)->makePartial(); |
|
| 134 | $type->shouldReceive('isOK')->andReturn(false); |
|
| 135 | ||
| 136 | $foo = new EntitySetAnonymousType(); |
|
| 137 | ||
| 138 | try { |
|
| 139 | $foo->addToTypeAnnotation($type); |
|
| 140 | } catch (\InvalidArgumentException $e) { |
|
| 141 | $actual = $e->getMessage(); |
|
| 142 | } |
|
| 143 | $this->assertEquals($expected, $actual); |
|
| 144 | } |
|
| 145 | ||
| 146 | public function testAddGoodTypeAnnotation() |
|
| 147 | { |
|
| @@ 159-175 (lines=17) @@ | ||
| 156 | $this->assertFalse($foo->issetTypeAnnotation(0)); |
|
| 157 | } |
|
| 158 | ||
| 159 | public function testAddBadDocumentation() |
|
| 160 | { |
|
| 161 | $expected = ''; |
|
| 162 | $actual = null; |
|
| 163 | ||
| 164 | $doc = m::mock(TDocumentationType::class); |
|
| 165 | $doc->shouldReceive('isOK')->andReturn(false); |
|
| 166 | ||
| 167 | $foo = new EntitySetAnonymousType(); |
|
| 168 | ||
| 169 | try { |
|
| 170 | $foo->addToDocumentation($doc); |
|
| 171 | } catch (\InvalidArgumentException $e) { |
|
| 172 | $actual = $e->getMessage(); |
|
| 173 | } |
|
| 174 | $this->assertEquals($expected, $actual); |
|
| 175 | } |
|
| 176 | ||
| 177 | public function testAddGoodDocumentation() |
|
| 178 | { |
|
| @@ 190-206 (lines=17) @@ | ||
| 187 | $this->assertFalse($foo->issetDocumentation(0)); |
|
| 188 | } |
|
| 189 | ||
| 190 | public function testSetBadDocumentation() |
|
| 191 | { |
|
| 192 | $expected = ''; |
|
| 193 | $actual = null; |
|
| 194 | ||
| 195 | $doc = m::mock(TDocumentationType::class); |
|
| 196 | $doc->shouldReceive('isOK')->andReturn(false); |
|
| 197 | ||
| 198 | $foo = new EntitySetAnonymousType(); |
|
| 199 | ||
| 200 | try { |
|
| 201 | $foo->setDocumentation([$doc]); |
|
| 202 | } catch (\InvalidArgumentException $e) { |
|
| 203 | $actual = $e->getMessage(); |
|
| 204 | } |
|
| 205 | $this->assertEquals($expected, $actual); |
|
| 206 | } |
|
| 207 | ||
| 208 | public function testSetBadValueAnnotation() |
|
| 209 | { |
|
| @@ 208-224 (lines=17) @@ | ||
| 205 | $this->assertEquals($expected, $actual); |
|
| 206 | } |
|
| 207 | ||
| 208 | public function testSetBadValueAnnotation() |
|
| 209 | { |
|
| 210 | $expected = ''; |
|
| 211 | $actual = null; |
|
| 212 | ||
| 213 | $type = m::mock(TValueAnnotationType::class)->makePartial(); |
|
| 214 | $type->shouldReceive('isOK')->andReturn(false); |
|
| 215 | ||
| 216 | $foo = new EntitySetAnonymousType(); |
|
| 217 | ||
| 218 | try { |
|
| 219 | $foo->setValueAnnotation([$type]); |
|
| 220 | } catch (\InvalidArgumentException $e) { |
|
| 221 | $actual = $e->getMessage(); |
|
| 222 | } |
|
| 223 | $this->assertEquals($expected, $actual); |
|
| 224 | } |
|
| 225 | ||
| 226 | public function testAddBadValueAnnotation() |
|
| 227 | { |
|
| @@ 226-242 (lines=17) @@ | ||
| 223 | $this->assertEquals($expected, $actual); |
|
| 224 | } |
|
| 225 | ||
| 226 | public function testAddBadValueAnnotation() |
|
| 227 | { |
|
| 228 | $expected = ''; |
|
| 229 | $actual = null; |
|
| 230 | ||
| 231 | $type = m::mock(TValueAnnotationType::class)->makePartial(); |
|
| 232 | $type->shouldReceive('isOK')->andReturn(false); |
|
| 233 | ||
| 234 | $foo = new EntitySetAnonymousType(); |
|
| 235 | ||
| 236 | try { |
|
| 237 | $foo->addToValueAnnotation($type); |
|
| 238 | } catch (\InvalidArgumentException $e) { |
|
| 239 | $actual = $e->getMessage(); |
|
| 240 | } |
|
| 241 | $this->assertEquals($expected, $actual); |
|
| 242 | } |
|
| 243 | ||
| 244 | public function testAddGoodValueAnnotation() |
|
| 245 | { |
|
| @@ 257-272 (lines=16) @@ | ||
| 254 | $this->assertFalse($foo->issetValueAnnotation(0)); |
|
| 255 | } |
|
| 256 | ||
| 257 | public function testIsOkTooManyDocumentation() |
|
| 258 | { |
|
| 259 | $expected = 'Supplied array not a valid array: ' |
|
| 260 | .'AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType'; |
|
| 261 | $actual = null; |
|
| 262 | ||
| 263 | $doc = m::mock(TDocumentationType::class); |
|
| 264 | $doc->shouldReceive('isOK')->andReturn(true); |
|
| 265 | ||
| 266 | $foo = new EntitySetAnonymousType(); |
|
| 267 | $foo->addToDocumentation($doc); |
|
| 268 | $foo->addToDocumentation($doc); |
|
| 269 | ||
| 270 | $this->assertFalse($foo->isOK($actual)); |
|
| 271 | $this->assertEquals($expected, $actual); |
|
| 272 | } |
|
| 273 | ||
| 274 | public function testIsOKBadTypeAnnotations() |
|
| 275 | { |
|
| @@ 274-287 (lines=14) @@ | ||
| 271 | $this->assertEquals($expected, $actual); |
|
| 272 | } |
|
| 273 | ||
| 274 | public function testIsOKBadTypeAnnotations() |
|
| 275 | { |
|
| 276 | $expected = ''; |
|
| 277 | $actual = null; |
|
| 278 | ||
| 279 | $type = m::mock(TTypeAnnotationType::class)->makePartial(); |
|
| 280 | $type->shouldReceive('isOK')->andReturn(true, false)->twice(); |
|
| 281 | ||
| 282 | $foo = new EntitySetAnonymousType(); |
|
| 283 | $foo->addToTypeAnnotation($type); |
|
| 284 | ||
| 285 | $this->assertFalse($foo->isOK($actual)); |
|
| 286 | $this->assertEquals($expected, $actual); |
|
| 287 | } |
|
| 288 | ||
| 289 | public function testIsOKBadValueAnnotations() |
|
| 290 | { |
|
| @@ 289-302 (lines=14) @@ | ||
| 286 | $this->assertEquals($expected, $actual); |
|
| 287 | } |
|
| 288 | ||
| 289 | public function testIsOKBadValueAnnotations() |
|
| 290 | { |
|
| 291 | $expected = ''; |
|
| 292 | $actual = null; |
|
| 293 | ||
| 294 | $type = m::mock(TValueAnnotationType::class)->makePartial(); |
|
| 295 | $type->shouldReceive('isOK')->andReturn(true, false)->twice(); |
|
| 296 | ||
| 297 | $foo = new EntitySetAnonymousType(); |
|
| 298 | $foo->addToValueAnnotation($type); |
|
| 299 | ||
| 300 | $this->assertFalse($foo->isOK($actual)); |
|
| 301 | $this->assertEquals($expected, $actual); |
|
| 302 | } |
|
| 303 | } |
|
| 304 | ||
| @@ 148-164 (lines=17) @@ | ||
| 145 | $this->assertEquals(0, count($foo->getReturnType())); |
|
| 146 | } |
|
| 147 | ||
| 148 | public function testSetReturnTypeBadData() |
|
| 149 | { |
|
| 150 | $expected = ''; |
|
| 151 | $actual = null; |
|
| 152 | ||
| 153 | $entitySet = m::mock(TFunctionImportReturnTypeType::class)->makePartial(); |
|
| 154 | $entitySet->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 155 | ||
| 156 | $foo = new FunctionImportAnonymousType(); |
|
| 157 | ||
| 158 | try { |
|
| 159 | $foo->setReturnType([$entitySet]); |
|
| 160 | } catch (\InvalidArgumentException $e) { |
|
| 161 | $actual = $e->getMessage(); |
|
| 162 | } |
|
| 163 | $this->assertEquals($expected, $actual); |
|
| 164 | } |
|
| 165 | ||
| 166 | public function testSetNameBadData() |
|
| 167 | { |
|
| @@ 254-270 (lines=17) @@ | ||
| 251 | $this->assertEquals($expected, $actual); |
|
| 252 | } |
|
| 253 | ||
| 254 | public function testSetBadDocumentation() |
|
| 255 | { |
|
| 256 | $expected = ''; |
|
| 257 | $actual = null; |
|
| 258 | ||
| 259 | $documentation = m::mock(TDocumentationType::class); |
|
| 260 | $documentation->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 261 | ||
| 262 | $foo = new FunctionImportAnonymousType(); |
|
| 263 | ||
| 264 | try { |
|
| 265 | $foo->setDocumentation($documentation); |
|
| 266 | } catch (\InvalidArgumentException $e) { |
|
| 267 | $actual = $e->getMessage(); |
|
| 268 | } |
|
| 269 | $this->assertEquals($expected, $actual); |
|
| 270 | } |
|
| 271 | ||
| 272 | public function testAddBadParameter() |
|
| 273 | { |
|
| @@ 272-288 (lines=17) @@ | ||
| 269 | $this->assertEquals($expected, $actual); |
|
| 270 | } |
|
| 271 | ||
| 272 | public function testAddBadParameter() |
|
| 273 | { |
|
| 274 | $expected = ''; |
|
| 275 | $actual = null; |
|
| 276 | ||
| 277 | $function = m::mock(TFunctionImportParameterType::class); |
|
| 278 | $function->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 279 | ||
| 280 | $foo = new FunctionImportAnonymousType(); |
|
| 281 | ||
| 282 | try { |
|
| 283 | $foo->addToParameter($function); |
|
| 284 | } catch (\InvalidArgumentException $e) { |
|
| 285 | $actual = $e->getMessage(); |
|
| 286 | } |
|
| 287 | $this->assertEquals($expected, $actual); |
|
| 288 | } |
|
| 289 | ||
| 290 | public function testAddGoodParameter() |
|
| 291 | { |
|
| @@ 304-320 (lines=17) @@ | ||
| 301 | $this->assertEquals(0, count($foo->getParameter())); |
|
| 302 | } |
|
| 303 | ||
| 304 | public function testSetBadParameterArray() |
|
| 305 | { |
|
| 306 | $expected = ''; |
|
| 307 | $actual = null; |
|
| 308 | ||
| 309 | $function = m::mock(TFunctionImportParameterType::class); |
|
| 310 | $function->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 311 | ||
| 312 | $foo = new FunctionImportAnonymousType(); |
|
| 313 | ||
| 314 | try { |
|
| 315 | $foo->setParameter([$function]); |
|
| 316 | } catch (\InvalidArgumentException $e) { |
|
| 317 | $actual = $e->getMessage(); |
|
| 318 | } |
|
| 319 | $this->assertEquals($expected, $actual); |
|
| 320 | } |
|
| 321 | ||
| 322 | public function testIsOkUnderParameterNameCollision() |
|
| 323 | { |
|
| @@ 355-368 (lines=14) @@ | ||
| 352 | $this->assertEquals($expected, $actual); |
|
| 353 | } |
|
| 354 | ||
| 355 | public function testIsNotOkFromBadDocumentation() |
|
| 356 | { |
|
| 357 | $expected = ''; |
|
| 358 | $actual = null; |
|
| 359 | ||
| 360 | $documentation = m::mock(TDocumentationType::class); |
|
| 361 | $documentation->shouldReceive('isOK')->andReturn(true, false)->once(); |
|
| 362 | ||
| 363 | $foo = new FunctionImportAnonymousType(); |
|
| 364 | $foo->setDocumentation($documentation); |
|
| 365 | ||
| 366 | $this->assertFalse($foo->isOK($actual)); |
|
| 367 | $this->assertEquals($expected, $actual); |
|
| 368 | } |
|
| 369 | } |
|
| 370 | ||
| @@ 134-150 (lines=17) @@ | ||
| 131 | $this->assertEquals($expected, $foo->getDateTimeOffset()); |
|
| 132 | } |
|
| 133 | ||
| 134 | public function testSetBadIf() |
|
| 135 | { |
|
| 136 | $expected = ''; |
|
| 137 | $actual = null; |
|
| 138 | ||
| 139 | $if = m::mock(TIfExpressionType::class); |
|
| 140 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 141 | ||
| 142 | $foo = new TOperandType(); |
|
| 143 | ||
| 144 | try { |
|
| 145 | $foo->setIf($if); |
|
| 146 | } catch (\InvalidArgumentException $e) { |
|
| 147 | $actual = $e->getMessage(); |
|
| 148 | } |
|
| 149 | $this->assertEquals($expected, $actual); |
|
| 150 | } |
|
| 151 | ||
| 152 | public function testSetGetIfRoundTrip() |
|
| 153 | { |
|
| @@ 164-180 (lines=17) @@ | ||
| 161 | $this->assertTrue($result->isOK()); |
|
| 162 | } |
|
| 163 | ||
| 164 | public function testSetBadRecord() |
|
| 165 | { |
|
| 166 | $expected = ''; |
|
| 167 | $actual = null; |
|
| 168 | ||
| 169 | $if = m::mock(TRecordExpressionType::class); |
|
| 170 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 171 | ||
| 172 | $foo = new TOperandType(); |
|
| 173 | ||
| 174 | try { |
|
| 175 | $foo->setRecord($if); |
|
| 176 | } catch (\InvalidArgumentException $e) { |
|
| 177 | $actual = $e->getMessage(); |
|
| 178 | } |
|
| 179 | $this->assertEquals($expected, $actual); |
|
| 180 | } |
|
| 181 | ||
| 182 | public function testSetGetRecordRoundTrip() |
|
| 183 | { |
|
| @@ 194-210 (lines=17) @@ | ||
| 191 | $this->assertTrue($result->isOK()); |
|
| 192 | } |
|
| 193 | ||
| 194 | public function testSetBadCollection() |
|
| 195 | { |
|
| 196 | $expected = ''; |
|
| 197 | $actual = null; |
|
| 198 | ||
| 199 | $if = m::mock(TCollectionExpressionType::class); |
|
| 200 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 201 | ||
| 202 | $foo = new TOperandType(); |
|
| 203 | ||
| 204 | try { |
|
| 205 | $foo->setCollection($if); |
|
| 206 | } catch (\InvalidArgumentException $e) { |
|
| 207 | $actual = $e->getMessage(); |
|
| 208 | } |
|
| 209 | $this->assertEquals($expected, $actual); |
|
| 210 | } |
|
| 211 | ||
| 212 | public function testSetGetCollectionRoundTrip() |
|
| 213 | { |
|
| @@ 224-240 (lines=17) @@ | ||
| 221 | $this->assertTrue($result->isOK()); |
|
| 222 | } |
|
| 223 | ||
| 224 | public function testSetBadTypeAssert() |
|
| 225 | { |
|
| 226 | $expected = ''; |
|
| 227 | $actual = null; |
|
| 228 | ||
| 229 | $if = m::mock(TTypeAssertExpressionType::class); |
|
| 230 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 231 | ||
| 232 | $foo = new TOperandType(); |
|
| 233 | ||
| 234 | try { |
|
| 235 | $foo->setTypeAssert($if); |
|
| 236 | } catch (\InvalidArgumentException $e) { |
|
| 237 | $actual = $e->getMessage(); |
|
| 238 | } |
|
| 239 | $this->assertEquals($expected, $actual); |
|
| 240 | } |
|
| 241 | ||
| 242 | public function testSetGetTypeAssertRoundTrip() |
|
| 243 | { |
|
| @@ 254-270 (lines=17) @@ | ||
| 251 | $this->assertTrue($result->isOK()); |
|
| 252 | } |
|
| 253 | ||
| 254 | public function testSetBadTypeTest() |
|
| 255 | { |
|
| 256 | $expected = ''; |
|
| 257 | $actual = null; |
|
| 258 | ||
| 259 | $if = m::mock(TTypeTestExpressionType::class); |
|
| 260 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 261 | ||
| 262 | $foo = new TOperandType(); |
|
| 263 | ||
| 264 | try { |
|
| 265 | $foo->setTypeTest($if); |
|
| 266 | } catch (\InvalidArgumentException $e) { |
|
| 267 | $actual = $e->getMessage(); |
|
| 268 | } |
|
| 269 | $this->assertEquals($expected, $actual); |
|
| 270 | } |
|
| 271 | ||
| 272 | public function testSetGetTypeTestRoundTrip() |
|
| 273 | { |
|
| @@ 284-300 (lines=17) @@ | ||
| 281 | $this->assertTrue($result->isOK()); |
|
| 282 | } |
|
| 283 | ||
| 284 | public function testSetBadFunctionReference() |
|
| 285 | { |
|
| 286 | $expected = ''; |
|
| 287 | $actual = null; |
|
| 288 | ||
| 289 | $if = m::mock(TFunctionReferenceExpressionType::class); |
|
| 290 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 291 | ||
| 292 | $foo = new TOperandType(); |
|
| 293 | ||
| 294 | try { |
|
| 295 | $foo->setFunctionReference($if); |
|
| 296 | } catch (\InvalidArgumentException $e) { |
|
| 297 | $actual = $e->getMessage(); |
|
| 298 | } |
|
| 299 | $this->assertEquals($expected, $actual); |
|
| 300 | } |
|
| 301 | ||
| 302 | public function testSetGetFunctionReferenceRoundTrip() |
|
| 303 | { |
|
| @@ 314-330 (lines=17) @@ | ||
| 311 | $this->assertTrue($result->isOK()); |
|
| 312 | } |
|
| 313 | ||
| 314 | public function testSetBadEntitySetReference() |
|
| 315 | { |
|
| 316 | $expected = ''; |
|
| 317 | $actual = null; |
|
| 318 | ||
| 319 | $if = m::mock(TEntitySetReferenceExpressionType::class); |
|
| 320 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 321 | ||
| 322 | $foo = new TOperandType(); |
|
| 323 | ||
| 324 | try { |
|
| 325 | $foo->setEntitySetReference($if); |
|
| 326 | } catch (\InvalidArgumentException $e) { |
|
| 327 | $actual = $e->getMessage(); |
|
| 328 | } |
|
| 329 | $this->assertEquals($expected, $actual); |
|
| 330 | } |
|
| 331 | ||
| 332 | public function testSetGetEntitySetReferenceRoundTrip() |
|
| 333 | { |
|
| @@ 344-360 (lines=17) @@ | ||
| 341 | $this->assertTrue($result->isOK()); |
|
| 342 | } |
|
| 343 | ||
| 344 | public function testSetBadAnonymousFunction() |
|
| 345 | { |
|
| 346 | $expected = ''; |
|
| 347 | $actual = null; |
|
| 348 | ||
| 349 | $if = m::mock(TAnonymousFunctionExpressionType::class); |
|
| 350 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 351 | ||
| 352 | $foo = new TOperandType(); |
|
| 353 | ||
| 354 | try { |
|
| 355 | $foo->setAnonymousFunction($if); |
|
| 356 | } catch (\InvalidArgumentException $e) { |
|
| 357 | $actual = $e->getMessage(); |
|
| 358 | } |
|
| 359 | $this->assertEquals($expected, $actual); |
|
| 360 | } |
|
| 361 | ||
| 362 | public function testSetGetAnonymousFunctionRoundTrip() |
|
| 363 | { |
|
| @@ 374-390 (lines=17) @@ | ||
| 371 | $this->assertTrue($result->isOK()); |
|
| 372 | } |
|
| 373 | ||
| 374 | public function testSetBadParameterReference() |
|
| 375 | { |
|
| 376 | $expected = ''; |
|
| 377 | $actual = null; |
|
| 378 | ||
| 379 | $if = m::mock(TParameterReferenceExpressionType::class); |
|
| 380 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 381 | ||
| 382 | $foo = new TOperandType(); |
|
| 383 | ||
| 384 | try { |
|
| 385 | $foo->setParameterReference($if); |
|
| 386 | } catch (\InvalidArgumentException $e) { |
|
| 387 | $actual = $e->getMessage(); |
|
| 388 | } |
|
| 389 | $this->assertEquals($expected, $actual); |
|
| 390 | } |
|
| 391 | ||
| 392 | public function testSetGetParameterReferenceRoundTrip() |
|
| 393 | { |
|
| @@ 404-420 (lines=17) @@ | ||
| 401 | $this->assertTrue($result->isOK()); |
|
| 402 | } |
|
| 403 | ||
| 404 | public function testSetBadApply() |
|
| 405 | { |
|
| 406 | $expected = ''; |
|
| 407 | $actual = null; |
|
| 408 | ||
| 409 | $if = m::mock(TApplyExpressionType::class); |
|
| 410 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 411 | ||
| 412 | $foo = new TOperandType(); |
|
| 413 | ||
| 414 | try { |
|
| 415 | $foo->setApply($if); |
|
| 416 | } catch (\InvalidArgumentException $e) { |
|
| 417 | $actual = $e->getMessage(); |
|
| 418 | } |
|
| 419 | $this->assertEquals($expected, $actual); |
|
| 420 | } |
|
| 421 | ||
| 422 | public function testSetGetApplyRoundTrip() |
|
| 423 | { |
|
| @@ 434-450 (lines=17) @@ | ||
| 431 | $this->assertTrue($result->isOK()); |
|
| 432 | } |
|
| 433 | ||
| 434 | public function testSetBadPropertyReference() |
|
| 435 | { |
|
| 436 | $expected = ''; |
|
| 437 | $actual = null; |
|
| 438 | ||
| 439 | $if = m::mock(TPropertyReferenceExpressionType::class); |
|
| 440 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 441 | ||
| 442 | $foo = new TOperandType(); |
|
| 443 | ||
| 444 | try { |
|
| 445 | $foo->setPropertyReference($if); |
|
| 446 | } catch (\InvalidArgumentException $e) { |
|
| 447 | $actual = $e->getMessage(); |
|
| 448 | } |
|
| 449 | $this->assertEquals($expected, $actual); |
|
| 450 | } |
|
| 451 | ||
| 452 | public function testSetGetPropertyReferenceRoundTrip() |
|
| 453 | { |
|
| @@ 464-480 (lines=17) @@ | ||
| 461 | $this->assertTrue($result->isOK()); |
|
| 462 | } |
|
| 463 | ||
| 464 | public function testSetBadValueTermReference() |
|
| 465 | { |
|
| 466 | $expected = ''; |
|
| 467 | $actual = null; |
|
| 468 | ||
| 469 | $if = m::mock(TValueTermReferenceExpressionType::class); |
|
| 470 | $if->shouldReceive('isOK')->andReturn(false); |
|
| 471 | ||
| 472 | $foo = new TOperandType(); |
|
| 473 | ||
| 474 | try { |
|
| 475 | $foo->setValueTermReference($if); |
|
| 476 | } catch (\InvalidArgumentException $e) { |
|
| 477 | $actual = $e->getMessage(); |
|
| 478 | } |
|
| 479 | $this->assertEquals($expected, $actual); |
|
| 480 | } |
|
| 481 | ||
| 482 | public function testSetGetValueTermReferenceRoundTrip() |
|
| 483 | { |
|
| @@ 374-388 (lines=15) @@ | ||
| 371 | $this->assertEquals($bar, $foo); |
|
| 372 | } |
|
| 373 | ||
| 374 | public function testCreateSingletonBadReturnType() |
|
| 375 | { |
|
| 376 | $returnType = m::mock(IsOK::class); |
|
| 377 | $foo = new MetadataManager(); |
|
| 378 | ||
| 379 | $expected = 'Expected return type must be either TEntityType or TComplexType'; |
|
| 380 | $actual = null; |
|
| 381 | ||
| 382 | try { |
|
| 383 | $foo->createSingleton(null, $returnType, null); |
|
| 384 | } catch (\InvalidArgumentException $e) { |
|
| 385 | $actual = $e->getMessage(); |
|
| 386 | } |
|
| 387 | $this->assertEquals($expected, $actual); |
|
| 388 | } |
|
| 389 | ||
| 390 | public function testCreateSingletonEmptyName() |
|
| 391 | { |
|