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