| @@ 146-162 (lines=17) @@ | ||
| 143 | $this->assertEquals(0, count($foo->getReturnType())); |
|
| 144 | } |
|
| 145 | ||
| 146 | public function testSetReturnTypeBadData() |
|
| 147 | { |
|
| 148 | $expected = ""; |
|
| 149 | $actual = null; |
|
| 150 | ||
| 151 | $entitySet = m::mock(TFunctionImportReturnTypeType::class)->makePartial(); |
|
| 152 | $entitySet->shouldReceive('isOK')->andReturn(false)->once(); |
|
| 153 | ||
| 154 | $foo = new FunctionImportAnonymousType(); |
|
| 155 | ||
| 156 | try { |
|
| 157 | $foo->setReturnType([$entitySet]); |
|
| 158 | } catch (\InvalidArgumentException $e) { |
|
| 159 | $actual = $e->getMessage(); |
|
| 160 | } |
|
| 161 | $this->assertEquals($expected, $actual); |
|
| 162 | } |
|
| 163 | ||
| 164 | public function testSetNameBadData() |
|
| 165 | { |
|
| @@ 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() |
|