| @@ 93-107 (lines=15) @@ | ||
| 90 | $this->assertEquals($expected, $actual); |
|
| 91 | } |
|
| 92 | ||
| 93 | public function testIsTTypeAttributesValidNameNotSimpleIdentifier() |
|
| 94 | { |
|
| 95 | $expectedStarts = "Name must be a valid TSimpleIdentifier:"; |
|
| 96 | $expectedEnds = "AlgoWeb_ODataMetadata_MetadataV3_edm_TEntityTypeType"; |
|
| 97 | $actual = null; |
|
| 98 | $name = " _ "; |
|
| 99 | ||
| 100 | $foo = m::mock(TEntityTypeType::class)->makePartial(); |
|
| 101 | $foo->shouldReceive('isTSimpleIdentifierValid')->withAnyArgs()->andReturn(true, false)->twice(); |
|
| 102 | $foo->setName($name); |
|
| 103 | ||
| 104 | $foo->isTTypeAttributesValid($actual); |
|
| 105 | $this->assertStringStartsWith($expectedStarts, $actual); |
|
| 106 | $this->assertStringEndsWith($expectedEnds, $actual); |
|
| 107 | } |
|
| 108 | } |
|
| 109 | ||
| @@ 62-76 (lines=15) @@ | ||
| 59 | $this->assertEquals($expected, $actual); |
|
| 60 | } |
|
| 61 | ||
| 62 | public function testIsTEntitySetAttributesOKBadName() |
|
| 63 | { |
|
| 64 | $expectedStarts = "Name must be a valid TSimpleIdentifier"; |
|
| 65 | $expectedEnds = "AlgoWeb_ODataMetadata_MetadataV3_edm_EntityContainer_EntitySetAnonymousType"; |
|
| 66 | $actual = null; |
|
| 67 | ||
| 68 | $foo = m::mock(EntitySetAnonymousType::class)->makePartial(); |
|
| 69 | $foo->shouldReceive('isTSimpleIdentifierValid')->andReturn(true, false)->twice(); |
|
| 70 | ||
| 71 | $foo->setName(" _ "); |
|
| 72 | ||
| 73 | $this->assertFalse($foo->isTEntitySetAttributesOK($actual)); |
|
| 74 | $this->assertStringStartsWith($expectedStarts, $actual); |
|
| 75 | $this->assertStringEndsWith($expectedEnds, $actual); |
|
| 76 | } |
|
| 77 | ||
| 78 | public function testIsTEntitySetAttributesOKBadEntityType() |
|
| 79 | { |
|
| @@ 78-92 (lines=15) @@ | ||
| 75 | $this->assertStringEndsWith($expectedEnds, $actual); |
|
| 76 | } |
|
| 77 | ||
| 78 | public function testIsTEntitySetAttributesOKBadEntityType() |
|
| 79 | { |
|
| 80 | $expectedStarts = "Entity type must be a valid TQualifiedName"; |
|
| 81 | $expectedEnds = "AlgoWeb_ODataMetadata_MetadataV3_edm_EntityContainer_EntitySetAnonymousType"; |
|
| 82 | $actual = null; |
|
| 83 | ||
| 84 | $foo = m::mock(EntitySetAnonymousType::class)->makePartial(); |
|
| 85 | $foo->shouldReceive('isTQualifiedNameValid')->andReturn(true, false)->twice(); |
|
| 86 | ||
| 87 | $foo->setEntityType(" _ "); |
|
| 88 | ||
| 89 | $this->assertFalse($foo->isTEntitySetAttributesOK($actual)); |
|
| 90 | $this->assertStringStartsWith($expectedStarts, $actual); |
|
| 91 | $this->assertStringEndsWith($expectedEnds, $actual); |
|
| 92 | } |
|
| 93 | ||
| 94 | public function testIsTEntitySetAttributesOKBadGetterAccess() |
|
| 95 | { |
|
| @@ 94-108 (lines=15) @@ | ||
| 91 | $this->assertStringEndsWith($expectedEnds, $actual); |
|
| 92 | } |
|
| 93 | ||
| 94 | public function testIsTEntitySetAttributesOKBadGetterAccess() |
|
| 95 | { |
|
| 96 | $expectedStarts = "Getter access must be a valid TAccess"; |
|
| 97 | $expectedEnds = "AlgoWeb_ODataMetadata_MetadataV3_edm_EntityContainer_EntitySetAnonymousType"; |
|
| 98 | $actual = null; |
|
| 99 | ||
| 100 | $foo = m::mock(EntitySetAnonymousType::class)->makePartial(); |
|
| 101 | $foo->shouldReceive('isTAccessOk')->andReturn(true, false)->twice(); |
|
| 102 | ||
| 103 | $foo->setGetterAccess(" _ "); |
|
| 104 | ||
| 105 | $this->assertFalse($foo->isTEntitySetAttributesOK($actual)); |
|
| 106 | $this->assertStringStartsWith($expectedStarts, $actual); |
|
| 107 | $this->assertStringEndsWith($expectedEnds, $actual); |
|
| 108 | } |
|
| 109 | ||
| 110 | public function testSetBadTypeAnnotation() |
|
| 111 | { |
|
| @@ 237-252 (lines=16) @@ | ||
| 234 | $this->assertStringEndsWith($expectedEnds, $actual); |
|
| 235 | } |
|
| 236 | ||
| 237 | public function testIsTFunctionImportAttributesValidWithBadReturnType() |
|
| 238 | { |
|
| 239 | $expected = ""; |
|
| 240 | $actual = null; |
|
| 241 | ||
| 242 | $entitySet = m::mock(TFunctionImportReturnTypeType::class)->makePartial(); |
|
| 243 | $entitySet->shouldReceive('isOK')->andReturn(true, false)->once(); |
|
| 244 | ||
| 245 | $foo = new FunctionImportAnonymousType(); |
|
| 246 | $foo->setName("Name"); |
|
| 247 | $foo->setMethodAccess('Public'); |
|
| 248 | $foo->addToReturnType($entitySet); |
|
| 249 | ||
| 250 | $this->assertFalse($foo->isTFunctionImportAttributesValid($actual)); |
|
| 251 | $this->assertEquals($expected, $actual); |
|
| 252 | } |
|
| 253 | ||
| 254 | public function testSetBadDocumentation() |
|
| 255 | { |
|