@@ 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 |