1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Test\FlexiPeeHP; |
4
|
|
|
|
5
|
|
|
use FlexiPeeHP\FlexiBeeRO; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-05-04 at 10:08:36. |
9
|
|
|
*/ |
10
|
|
|
class FlexiBeeROTest extends \Test\Ease\BrickTest |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var FlexiBeeRO |
14
|
|
|
*/ |
15
|
|
|
protected $object; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Sets up the fixture, for example, opens a network connection. |
19
|
|
|
* This method is called before a test is executed. |
20
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::__construct |
21
|
|
|
*/ |
22
|
|
|
protected function setUp() |
23
|
|
|
{ |
24
|
|
|
$this->object = new FlexiBeeRO(); |
25
|
|
|
$this->object->prefix = ''; |
26
|
|
|
$this->object->company = ''; |
27
|
|
|
$this->object->debug = true; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Tears down the fixture, for example, closes a network connection. |
32
|
|
|
* This method is called after a test is executed. |
33
|
|
|
*/ |
34
|
|
|
protected function tearDown() |
35
|
|
|
{ |
36
|
|
|
|
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::logBanner |
41
|
|
|
*/ |
42
|
|
|
public function testLogBanner() |
43
|
|
|
{ |
44
|
|
|
$this->object->logBanner(addslashes(get_class($this))); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Test Constructor |
49
|
|
|
* |
50
|
|
|
* @depends testLogBanner |
51
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::__construct |
52
|
|
|
*/ |
53
|
|
|
public function testConstructor() |
54
|
|
|
{ |
55
|
|
|
$classname = get_class($this->object); |
56
|
|
|
$evidence = $this->object->getEvidence(); |
57
|
|
|
|
58
|
|
|
// Get mock, without the constructor being called |
59
|
|
|
$mock = $this->getMockBuilder($classname) |
60
|
|
|
->disableOriginalConstructor() |
61
|
|
|
->getMockForAbstractClass(); |
62
|
|
|
$mock->__construct(1, ['debug' => false]); |
63
|
|
|
|
64
|
|
|
if (!isset(\FlexiPeeHP\EvidenceList::$name[$evidence])) { |
65
|
|
|
$evidence = 'adresar'; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
$mock->__construct('', |
69
|
|
|
[ |
70
|
|
|
'company' => 'Firma_s_r_o_', |
71
|
|
|
'url' => 'https://flexibee.firma.cz/', |
72
|
|
|
'user' => 'rest', |
73
|
|
|
'password' => '-dj3x21xaA_', |
74
|
|
|
'debug' => true, |
75
|
|
|
'prefix' => 'c', |
76
|
|
|
'evidence' => $evidence]); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::curlInit |
81
|
|
|
*/ |
82
|
|
|
public function testSetupProperty() |
83
|
|
|
{ |
84
|
|
|
$properties = ['debug' => true]; |
85
|
|
|
$this->object->setupProperty($properties, 'debug'); |
86
|
|
|
$this->assertTrue($this->object->debug); |
87
|
|
|
$this->object->setupProperty($properties, 'url', 'FLEXIBEE_URL'); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::curlInit |
92
|
|
|
*/ |
93
|
|
|
public function testCurlInit() |
94
|
|
|
{ |
95
|
|
|
$this->object->curlInit(); |
96
|
|
|
$this->assertTrue(is_resource($this->object->curl)); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::processInit |
101
|
|
|
*/ |
102
|
|
|
public function testProcessInit() |
103
|
|
|
{ |
104
|
|
|
$this->object->processInit(['id' => 1]); |
105
|
|
|
$this->assertEquals(1, $this->object->getDataValue('id')); |
106
|
|
|
|
107
|
|
|
if (!is_null($this->object->evidence) && $this->object->evidence != 'test') { |
108
|
|
|
|
109
|
|
|
|
110
|
|
|
$firstID = $this->object->getColumnsFromFlexibee(['id', 'kod'], |
111
|
|
|
['limit' => 1]); |
112
|
|
|
|
113
|
|
|
if (count($firstID) && isset($firstID[0]['id'])) { |
114
|
|
|
|
115
|
|
|
$this->object->processInit((int) current($firstID)); |
116
|
|
|
$this->assertNotEmpty($this->object->__toString()); |
117
|
|
|
|
118
|
|
|
if (isset($firstID[0]['kod'])) { |
119
|
|
|
$this->object->processInit('code:'.$firstID[0]['kod']); |
120
|
|
|
$this->assertNotEmpty($this->object->__toString()); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
$this->object->processInit($this->object->getEvidenceURL().'/'.$firstID[0]['id'].'.xml'); |
124
|
|
|
} else { |
125
|
|
|
$this->markTestSkipped(sprintf('Evidence %s doed not contain first record', |
126
|
|
|
$this->object->getEvidence())); |
127
|
|
|
} |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::setUp |
133
|
|
|
*/ |
134
|
|
|
public function testSetUp() |
135
|
|
|
{ |
136
|
|
|
$this->object->setUp( |
137
|
|
|
[ |
138
|
|
|
'company' => 'cmp', |
139
|
|
|
'url' => 'url', |
140
|
|
|
'user' => 'usr', |
141
|
|
|
'password' => 'pwd', |
142
|
|
|
'prefix' => 'c', |
143
|
|
|
'debug' => true, |
144
|
|
|
'defaultUrlParams' => ['limit' => 10], |
145
|
|
|
'evidence' => 'smlouva' |
146
|
|
|
] |
147
|
|
|
); |
148
|
|
|
$this->assertEquals('cmp', $this->object->company); |
149
|
|
|
$this->assertEquals('url', $this->object->url); |
150
|
|
|
$this->assertEquals('usr', $this->object->user); |
151
|
|
|
$this->assertEquals('/c/', $this->object->prefix); |
152
|
|
|
$this->assertEquals('pwd', $this->object->password); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::setPrefix |
157
|
|
|
* @expectedException \Exception |
158
|
|
|
*/ |
159
|
|
|
public function testSetPrefix() |
160
|
|
|
{ |
161
|
|
|
$this->object->setPrefix('c'); |
162
|
|
|
$this->assertEquals('/c/', $this->object->prefix); |
163
|
|
|
$this->object->setPrefix(null); |
164
|
|
|
$this->assertEquals('', $this->object->prefix); |
165
|
|
|
$this->object->setPrefix('fail'); |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::setFormat |
170
|
|
|
*/ |
171
|
|
|
public function testSetFormat() |
172
|
|
|
{ |
173
|
|
|
$this->object->setFormat('xml'); |
174
|
|
|
$this->assertEquals('xml', $this->object->format); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* We can set only evidence defined in EvidenceList class |
179
|
|
|
* |
180
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::setEvidence |
181
|
|
|
* @expectedException \Exception |
182
|
|
|
*/ |
183
|
|
|
public function testSetEvidence() |
184
|
|
|
{ |
185
|
|
|
$this->object->setEvidence('adresar'); |
186
|
|
|
$this->assertEquals('adresar', $this->object->evidence); |
187
|
|
|
$this->object->setPrefix('c'); |
188
|
|
|
$this->object->debug = true; |
189
|
|
|
$this->object->setEvidence('fail'); |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::setCompany |
194
|
|
|
*/ |
195
|
|
|
public function testSetCompany() |
196
|
|
|
{ |
197
|
|
|
$this->object->setCompany('test_s_r_o_'); |
198
|
|
|
$this->assertEquals('test_s_r_o_', $this->object->company); |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::object2array |
203
|
|
|
*/ |
204
|
|
|
public function testObject2array() |
205
|
|
|
{ |
206
|
|
|
$this->assertNull($this->object->object2array(new \stdClass())); |
207
|
|
|
$this->assertEquals( |
208
|
|
|
[ |
209
|
|
|
'item' => 1, |
210
|
|
|
'arrItem' => ['a', 'b' => 'c'] |
211
|
|
|
] |
212
|
|
|
, $this->object->object2array(new \Test\ObjectForTesting())); |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::objectToID |
217
|
|
|
*/ |
218
|
|
|
public function testObjectToID() |
219
|
|
|
{ |
220
|
|
|
$this->object->setDataValue('kod', 'TEST'); |
221
|
|
|
$this->assertEquals('code:TEST', |
222
|
|
|
$this->object->objectToID($this->object)); |
223
|
|
|
|
224
|
|
|
$this->assertEquals('TEST', $this->object->objectToID('TEST')); |
|
|
|
|
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::performRequest |
229
|
|
|
*/ |
230
|
|
|
public function testPerformRequest() |
231
|
|
|
{ |
232
|
|
|
$evidence = $this->object->getEvidence(); |
233
|
|
|
switch ($evidence) { |
234
|
|
|
case null: |
235
|
|
|
case '': |
236
|
|
|
case 'c': |
237
|
|
|
case 'test': |
238
|
|
|
case 'status': |
239
|
|
|
case 'nastaveni': |
240
|
|
|
$this->object->performRequest(null, 'GET', 'xml'); |
241
|
|
|
break; |
242
|
|
|
|
243
|
|
|
default: |
244
|
|
|
$json = $this->object->performRequest(null, 'GET', 'json'); |
|
|
|
|
245
|
|
|
$xml = $this->object->performRequest(null, 'GET', 'xml'); |
|
|
|
|
246
|
|
|
break; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
//404 Test |
250
|
|
|
$this->assertNull($this->object->performRequest('error404.json')); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::setAction |
255
|
|
|
*/ |
256
|
|
|
public function testSetAction() |
257
|
|
|
{ |
258
|
|
|
switch ($this->object->getEvidence()) { |
259
|
|
|
case '': |
260
|
|
|
case 'c': |
261
|
|
|
case 'hooks': |
262
|
|
|
case 'status': |
263
|
|
|
case 'changes': |
264
|
|
|
case 'nastaveni': |
265
|
|
|
case 'evidence-list': |
266
|
|
|
$this->object->setAction('none'); |
267
|
|
|
break; |
268
|
|
|
default: |
269
|
|
|
$this->assertTrue($this->object->setAction('new')); |
270
|
|
|
$this->object->actionsAvailable = []; |
271
|
|
|
$this->assertFalse($this->object->setAction('none')); |
272
|
|
|
$this->object->actionsAvailable = ['copy']; |
273
|
|
|
$this->assertFalse($this->object->setAction('none')); |
274
|
|
|
break; |
275
|
|
|
} |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getEvidence |
280
|
|
|
*/ |
281
|
|
|
public function testGetEvidence() |
282
|
|
|
{ |
283
|
|
|
$this->assertEquals($this->object->evidence, |
284
|
|
|
$this->object->getEvidence()); |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getCompany |
289
|
|
|
*/ |
290
|
|
|
public function testGetCompany() |
291
|
|
|
{ |
292
|
|
|
$this->assertEquals($this->object->company, $this->object->getCompany()); |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getResponseEvidence |
297
|
|
|
*/ |
298
|
|
View Code Duplication |
public function testGetResponseEvidence() |
|
|
|
|
299
|
|
|
{ |
300
|
|
|
$responseEvidence = $this->object->getResponseEvidence(); |
301
|
|
|
switch ($this->object->getEvidence()) { |
302
|
|
|
case '': |
303
|
|
|
case 'c': |
304
|
|
|
case 'hooks': |
305
|
|
|
case 'status': |
306
|
|
|
case 'changes': |
307
|
|
|
case 'nastaveni': |
308
|
|
|
case 'evidence-list': |
309
|
|
|
break; |
310
|
|
|
default: |
311
|
|
|
$this->assertEquals($this->object->getEvidence(), |
312
|
|
|
$responseEvidence); |
313
|
|
|
break; |
314
|
|
|
} |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getLastInsertedId |
319
|
|
|
* @depends testInsertToFlexiBee |
320
|
|
|
*/ |
321
|
|
|
public function testGetLastInsertedId() |
322
|
|
|
{ |
323
|
|
|
$this->assertNotEmpty($this->object->getLastInsertedId()); |
|
|
|
|
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
/** |
327
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::xml2array |
328
|
|
|
*/ |
329
|
|
|
public function testXml2array() |
330
|
|
|
{ |
331
|
|
|
$xml = '<card xmlns="http://businesscard.org"> |
332
|
|
|
<name>John Doe</name> |
333
|
|
|
<title>CEO, Widget Inc.</title> |
334
|
|
|
<email>[email protected]</email> |
335
|
|
|
<phone>(202) 456-1414</phone> |
336
|
|
|
<logo url="widget.gif"/> |
337
|
|
|
<a><b>c</b></a> |
338
|
|
|
</card>'; |
339
|
|
|
|
340
|
|
|
$data = ['name' => 'John Doe', 'title' => 'CEO, Widget Inc.', 'email' => '[email protected]', |
341
|
|
|
'phone' => '(202) 456-1414', 'logo' => '', 'a' => [['b' => 'c']]]; |
342
|
|
|
|
343
|
|
|
|
344
|
|
|
$this->assertEquals($data, $this->object->xml2array($xml)); |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::disconnect |
349
|
|
|
* |
350
|
|
|
* @depends testPerformRequest |
351
|
|
|
* @depends testLoadFlexiData |
352
|
|
|
* @depends testGetFlexiRow |
353
|
|
|
* @depends testGetFlexiData |
354
|
|
|
* @depends testLoadFromFlexiBee |
355
|
|
|
* @depends testInsertToFlexiBee |
356
|
|
|
* @depends testIdExists |
357
|
|
|
* @depends testRecordExists |
358
|
|
|
* @depends testGetColumnsFromFlexibee |
359
|
|
|
* @depends testSearchString |
360
|
|
|
*/ |
361
|
|
|
public function testDisconnect() |
362
|
|
|
{ |
363
|
|
|
$this->object->disconnect(); |
364
|
|
|
$this->assertNull($this->object->curl); |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::__destruct |
369
|
|
|
* @depends testDisconnect |
370
|
|
|
*/ |
371
|
|
|
public function testdestruct() |
372
|
|
|
{ |
373
|
|
|
$this->markTestSkipped(); |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
/** |
377
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getFlexiRow |
378
|
|
|
*/ |
379
|
|
|
public function testGetFlexiRow() |
380
|
|
|
{ |
381
|
|
|
$this->object->getFlexiRow(0); |
382
|
|
|
$this->object->getFlexiRow(1); |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
/** |
386
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getFlexiData |
387
|
|
|
*/ |
388
|
|
|
public function testGetFlexiData() |
389
|
|
|
{ |
390
|
|
|
$evidence = $this->object->getEvidence(); |
391
|
|
|
switch ($evidence) { |
392
|
|
|
case null: |
393
|
|
|
$this->object->getFlexiData(); |
394
|
|
|
break; |
395
|
|
|
case 'c': |
396
|
|
|
$this->object->evidence = 'c'; |
397
|
|
|
$this->object->prefix = ''; |
398
|
|
|
$this->object->company = ''; |
399
|
|
|
$this->object->nameSpace = 'companies'; |
400
|
|
|
$flexidata = $this->object->getFlexiData(); |
401
|
|
|
$this->assertArrayHasKey('company', $flexidata); |
402
|
|
|
break; |
403
|
|
|
case 'evidence-list': |
404
|
|
|
$flexidata = $this->object->getFlexiData(null, |
405
|
|
|
['detail' => 'id']); |
406
|
|
|
$this->assertArrayHasKey('evidenceType', $flexidata[0]); |
407
|
|
|
break; |
408
|
|
|
|
409
|
|
|
default: |
410
|
|
|
$flexidata = $this->object->getFlexiData(null, |
411
|
|
|
['detail' => 'id']); |
412
|
|
|
|
413
|
|
|
if (is_array($flexidata)) { |
414
|
|
|
if (count($flexidata)) { |
415
|
|
|
$this->markTestSkipped('Empty evidence'); |
416
|
|
|
} else { |
417
|
|
|
$this->assertArrayHasKey(0, $flexidata); |
418
|
|
|
|
419
|
|
|
$this->assertArrayHasKey('id', $flexidata[0]); |
420
|
|
|
$filtrered = $this->object->getFlexiData(null, |
421
|
|
|
["id = ".$flexidata[0]['id'], 'detail' => 'full']); |
422
|
|
|
$this->assertArrayHasKey(0, $filtrered); |
423
|
|
|
$this->assertArrayHasKey('id', $filtrered[0]); |
424
|
|
|
} |
425
|
|
|
} |
426
|
|
|
break; |
427
|
|
|
} |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
/** |
431
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::loadFromFlexiBee |
432
|
|
|
*/ |
433
|
|
|
public function testLoadFromFlexiBee() |
434
|
|
|
{ |
435
|
|
|
$this->object->loadFromFlexiBee(); |
436
|
|
|
$this->object->loadFromFlexiBee(222); |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getJsonizedData |
441
|
|
|
*/ |
442
|
|
|
public function testGetJsonizedData() |
443
|
|
|
{ |
444
|
|
|
$this->assertEquals('{"'.$this->object->nameSpace.'":{"@version":"1.0","'.$this->object->evidence.'":{"key":"value"}}}', |
445
|
|
|
$this->object->getJsonizedData(['key' => 'value'])); |
446
|
|
|
|
447
|
|
|
switch ($this->object->getEvidence()) { |
448
|
|
|
case '': |
449
|
|
|
case 'c': |
450
|
|
|
case 'hooks': |
451
|
|
|
case 'status': |
452
|
|
|
case 'changes': |
453
|
|
|
case 'nastaveni': |
454
|
|
|
case 'evidence-list': |
455
|
|
|
$this->object->getJsonizedData(['key' => 'value']); |
456
|
|
|
break; |
457
|
|
|
default: |
458
|
|
|
$this->object->setAction('copy'); |
459
|
|
|
$this->assertEquals('{"'.$this->object->nameSpace.'":{"@version":"1.0","'.$this->object->evidence.'":{"key":"value"},"'.$this->object->evidence.'@action":"copy"}}', |
460
|
|
|
$this->object->getJsonizedData(['key' => 'value'])); |
461
|
|
|
break; |
462
|
|
|
|
463
|
|
|
$this->object->action = 'storno'; |
|
|
|
|
464
|
|
|
$this->object->filter = "stavUhrK = 'stavUhr.uhrazeno'"; |
465
|
|
|
$this->object->getJsonizedData([]); |
466
|
|
|
} |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
/** |
470
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getDataForJSON |
471
|
|
|
*/ |
472
|
|
|
public function testGetDataForJson() |
473
|
|
|
{ |
474
|
|
|
$this->object->getDataForJSON(); |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
/** |
478
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::idExists |
479
|
|
|
*/ |
480
|
|
|
public function testIdExists() |
481
|
|
|
{ |
482
|
|
|
$this->assertFalse($this->object->idExists('nonexistent')); |
483
|
|
|
switch ($this->object->getEvidence()) { |
484
|
|
|
case '': |
485
|
|
|
case 'c': |
486
|
|
|
case 'hooks': |
487
|
|
|
case 'status': |
488
|
|
|
case 'changes': |
489
|
|
|
case 'nastaveni': |
490
|
|
|
case 'evidence-list': |
491
|
|
|
break; |
492
|
|
|
default: |
493
|
|
|
$first = $this->object->getColumnsFromFlexibee(['id'], |
494
|
|
|
['limit' => 1], 'id'); |
495
|
|
|
if (empty($first)) { |
496
|
|
|
$this->markTestSkipped('empty evidence ?'); |
497
|
|
|
} else { |
498
|
|
|
$this->object->setData($first); |
499
|
|
|
$this->assertTrue($this->object->idExists()); |
500
|
|
|
} |
501
|
|
|
break; |
502
|
|
|
} |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
/** |
506
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getRecordID |
507
|
|
|
*/ |
508
|
|
|
public function testGetRecordID() |
509
|
|
|
{ |
510
|
|
|
$this->object->setData([$this->object->getmyKeyColumn() => 10]); |
511
|
|
|
$this->assertEquals(10, $this->object->getRecordID()); |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
/** |
515
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::recordExists |
516
|
|
|
*/ |
517
|
|
|
public function testRecordExists() |
518
|
|
|
{ |
519
|
|
|
$evidence = $this->object->getEvidence(); |
520
|
|
|
|
521
|
|
|
switch ($evidence) { |
522
|
|
|
case null: |
523
|
|
|
case 'c': |
524
|
|
|
case 'status': |
525
|
|
|
case 'evidence-list': |
526
|
|
|
$this->object->recordExists(['id' => 1]); |
527
|
|
|
break; |
528
|
|
|
|
529
|
|
|
default: |
530
|
|
|
$flexidata = $this->object->getFlexiData(null, |
531
|
|
|
['limit' => 1, 'detail' => 'id']); |
532
|
|
|
if (is_array($flexidata) && !count($flexidata)) { |
533
|
|
|
$this->assertFalse($this->object->recordExists(['id' => 1]), |
534
|
|
|
'Record ID 1 exists in empty evidence ?'); |
535
|
|
|
} else { |
536
|
|
|
if (!is_null($flexidata)) { |
537
|
|
|
$this->object->setData(['id' => (int) $flexidata[0]['id']]); |
538
|
|
|
$this->assertTrue($this->object->recordExists(), |
539
|
|
|
'First record exists test failed'); |
540
|
|
|
$this->assertFalse($this->object->recordExists(['id' => 0]), |
541
|
|
|
'Record ID 0 exists'); |
542
|
|
|
$this->assertFalse($this->object->recordExists(['unexistent' => 1]), |
543
|
|
|
'Unexistent Record exist ?'); |
544
|
|
|
} |
545
|
|
|
} |
546
|
|
|
break; |
547
|
|
|
} |
548
|
|
|
} |
549
|
|
|
|
550
|
|
|
/** |
551
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getColumnsFromFlexibee |
552
|
|
|
*/ |
553
|
|
|
public function testGetColumnsFromFlexibee() |
554
|
|
|
{ |
555
|
|
|
|
556
|
|
|
switch ($this->object->getEvidence()) { |
557
|
|
|
case '': |
558
|
|
|
case 'c': |
559
|
|
|
case 'hooks': |
560
|
|
|
case 'status': |
561
|
|
|
case 'changes': |
562
|
|
|
case 'nastaveni': |
563
|
|
|
case 'evidence-list': |
564
|
|
|
break; |
565
|
|
|
default: |
566
|
|
|
$structure = $this->object->getColumnsInfo(); |
567
|
|
|
|
568
|
|
|
$columns = $this->object->getColumnsFromFlexibee([current(array_keys($structure))], |
|
|
|
|
569
|
|
|
['limit' => 1], 'id'); |
570
|
|
|
break; |
571
|
|
|
} |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
/** |
575
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getExternalID |
576
|
|
|
*/ |
577
|
|
|
public function testGetExternalID() |
578
|
|
|
{ |
579
|
|
|
$this->assertTrue(empty($this->object->getExternalID('ext:test:10'))); //ext: does not exist |
580
|
|
|
|
581
|
|
|
$this->object->setDataValue('external-ids', |
582
|
|
|
['ext:doe:22', 'ext:test:10']); |
583
|
|
|
|
584
|
|
|
$this->assertEquals('ext:doe:22', $this->object->getExternalID()); |
585
|
|
|
$this->assertEquals('10', $this->object->getExternalID('test')); |
586
|
|
|
} |
587
|
|
|
|
588
|
|
|
/** |
589
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getGlobalVersion |
590
|
|
|
*/ |
591
|
|
View Code Duplication |
public function testGetGlobalVersion() |
|
|
|
|
592
|
|
|
{ |
593
|
|
|
switch ($this->object->getEvidence()) { |
594
|
|
|
case '': |
595
|
|
|
case 'c': |
596
|
|
|
case 'hooks': |
597
|
|
|
case 'status': |
598
|
|
|
case 'changes': |
599
|
|
|
case 'nastaveni': |
600
|
|
|
case 'evidence-list': |
601
|
|
|
$this->object->getGlobalVersion(); |
602
|
|
|
break; |
603
|
|
|
default: |
604
|
|
|
$this->assertInternalType("int", |
605
|
|
|
$this->object->getGlobalVersion(), |
606
|
|
|
'error obtaining of GlobalVersion'); |
607
|
|
|
break; |
608
|
|
|
} |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
/** |
612
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getResponseFormat |
613
|
|
|
*/ |
614
|
|
|
public function testGetResponseFormat() |
615
|
|
|
{ |
616
|
|
|
$this->object->performRequest(null, 'GET', 'json'); |
617
|
|
|
$this->assertEquals('application/json', |
618
|
|
|
$this->object->getResponseFormat()); |
619
|
|
|
$this->object->performRequest(null, 'GET', 'xml'); |
620
|
|
|
$this->assertEquals('application/xml', |
621
|
|
|
$this->object->getResponseFormat()); |
622
|
|
|
} |
623
|
|
|
|
624
|
|
|
/** |
625
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getKod |
626
|
|
|
*/ |
627
|
|
|
public function testGetKod() |
628
|
|
|
{ |
629
|
|
|
$testString = []; |
630
|
|
|
$this->assertEquals('code:CODE', |
631
|
|
|
$this->object->getKod([$this->object->keyColumn => 'code'])); |
|
|
|
|
632
|
|
|
|
633
|
|
|
$testString[$this->object->nameColumn] = 'Fish clamp - Úchytka pro instalaci samonosných kabelů ' |
634
|
|
|
.'(3.5 mm)'; |
635
|
|
|
$code0 = $this->object->getKod($testString); |
636
|
|
|
$this->assertEquals('code:FISHCLAMPUCHYTKAPR', $code0); |
637
|
|
|
$code1 = $this->object->getKod($testString, |
638
|
|
|
false); |
639
|
|
|
$this->assertEquals('code:FISHCLAMPUCHYTKAPR', $code1); |
640
|
|
|
$code2 = $this->object->getKod($testString); |
641
|
|
|
$this->assertEquals('code:FISHCLAMPUCHYTKAPR1', $code2); |
642
|
|
|
$this->object->setData($testString); |
643
|
|
|
$code3 = $this->object->getKod(); |
644
|
|
|
$this->assertEquals('code:FISHCLAMPUCHYTKAPR2', $code3); |
645
|
|
|
|
646
|
|
|
$this->assertEquals('code:TEST', |
647
|
|
|
$this->object->getKod([$this->object->nameColumn => 'test'])); |
648
|
|
|
|
649
|
|
|
$this->assertEquals('code:TEST1', $this->object->getKod('test')); |
650
|
|
|
|
651
|
|
|
$this->assertEquals('code:TEST2', |
652
|
|
|
$this->object->getKod(['kod' => 'test'])); |
653
|
|
|
$this->assertEquals('code:NOTSET', $this->object->getKod(['kod' => ''])); |
654
|
|
|
} |
655
|
|
|
|
656
|
|
|
/** |
657
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::logResult |
658
|
|
|
*/ |
659
|
|
|
public function testLogResult() |
660
|
|
|
{ |
661
|
|
|
$this->object->cleanMessages(); |
662
|
|
|
$success = json_decode('{"winstrom":{"@version":"1.0","success":"true",' |
663
|
|
|
.'"stats":{"created":"0","updated":"1","deleted":"0","skipped":"0"' |
664
|
|
|
.',"failed":"0"},"results":[{"id":"1","request-id":"ext:SōkoMan.item' |
665
|
|
|
.':5271","ref":"/c/spoje_net_s_r_o_1/skladovy-pohyb/1.json"}]}}'); |
666
|
|
|
$this->object->logResult(current($this->object->object2array($success)), |
667
|
|
|
'http://test'); |
668
|
|
|
|
669
|
|
|
$this->assertArrayHasKey('info', $this->object->getStatusMessages(true)); |
670
|
|
|
|
671
|
|
|
$error = json_decode('{"winstrom":{"@version":"1.0","success":"false",' |
672
|
|
|
.'"stats":{"created":"0","updated":"0","deleted":"0","skipped":"0"' |
673
|
|
|
.',"failed":"0"},"results":[{"errors":[{"message":"cz.winstrom.' |
674
|
|
|
.'service.WSBusinessException: Zadaný kód není unikátní.\nZadaný' |
675
|
|
|
.' kód není unikátní."}]}]}}'); |
676
|
|
|
$this->object->lastResponseCode = 500; |
677
|
|
|
$this->object->logResult(current($this->object->object2array($error))); |
678
|
|
|
$this->assertArrayHasKey('error', $this->object->getStatusMessages(true)); |
679
|
|
|
} |
680
|
|
|
|
681
|
|
|
/** |
682
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::flexiUrl |
683
|
|
|
*/ |
684
|
|
|
public function testFlexiUrl() |
685
|
|
|
{ |
686
|
|
|
$this->assertEquals("a eq '1' and b eq 'foo'", |
687
|
|
|
$this->object->flexiUrl(['a' => 1, 'b' => 'foo'], 'and')); |
688
|
|
|
$this->assertEquals("a eq '1' or b eq 'bar'", |
689
|
|
|
$this->object->flexiUrl(['a' => 1, 'b' => 'bar'], 'or')); |
690
|
|
|
$this->assertEquals("a eq true or b eq false", |
691
|
|
|
$this->object->flexiUrl(['a' => true, 'b' => false], 'or')); |
692
|
|
|
$this->assertEquals("a is null and b is not null", |
693
|
|
|
$this->object->flexiUrl(['a' => null, 'b' => '!null'], 'and')); |
694
|
|
|
} |
695
|
|
|
|
696
|
|
|
/** |
697
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::unifyResponseFormat |
698
|
|
|
*/ |
699
|
|
|
public function testunifyResponseFormat() |
700
|
|
|
{ |
701
|
|
|
$this->assertNull($this->object->unifyResponseFormat(null)); |
|
|
|
|
702
|
|
|
//One Row Test |
703
|
|
|
|
704
|
|
|
$responseEvidence = $this->object->getResponseEvidence(); |
705
|
|
|
if (empty($responseEvidence)) { |
706
|
|
|
$responseEvidence = $this->object->evidence = 'test'; |
707
|
|
|
} |
708
|
|
|
|
709
|
|
|
$test1raw = [$responseEvidence => |
710
|
|
|
['id' => 1, 'name' => 'value'] |
711
|
|
|
]; |
712
|
|
|
|
713
|
|
|
$test1expected = [$responseEvidence => |
714
|
|
|
[ |
715
|
|
|
['id' => 1, 'name' => 'value'] |
716
|
|
|
] |
717
|
|
|
]; |
718
|
|
|
|
719
|
|
|
$this->assertEquals($test1expected, |
720
|
|
|
$this->object->unifyResponseFormat($test1raw)); |
721
|
|
|
|
722
|
|
|
//Two Row Test |
723
|
|
|
$test2Raw = [$this->object->getResponseEvidence() => |
724
|
|
|
[ |
725
|
|
|
['id' => 1, 'name' => 'value'], |
726
|
|
|
['id' => 2, 'name' => 'value2'] |
727
|
|
|
] |
728
|
|
|
]; |
729
|
|
|
|
730
|
|
|
$test2expected = [$this->object->getResponseEvidence() => |
731
|
|
|
[ |
732
|
|
|
['id' => 1, 'name' => 'value'], |
733
|
|
|
['id' => 2, 'name' => 'value2'] |
734
|
|
|
] |
735
|
|
|
]; |
736
|
|
|
|
737
|
|
|
$this->assertEquals($test2expected, |
738
|
|
|
$this->object->unifyResponseFormat($test2Raw)); |
739
|
|
|
} |
740
|
|
|
|
741
|
|
|
/** |
742
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::__toString |
743
|
|
|
*/ |
744
|
|
|
public function testtoString() |
745
|
|
|
{ |
746
|
|
|
$id = '123'; |
747
|
|
|
$this->object->setMyKey($id); |
748
|
|
|
$this->assertEquals($id, (string) $this->object); |
749
|
|
|
|
750
|
|
|
$code = 'test'; |
751
|
|
|
$this->object->setDataValue('kod', $code); |
752
|
|
|
$this->assertEquals('code:'.$code, (string) $this->object); |
753
|
|
|
|
754
|
|
|
$identifer = 'ext:test:123'; |
755
|
|
|
$this->object->setMyKey($identifer); |
756
|
|
|
$this->assertEquals($identifer, (string) $this->object); |
757
|
|
|
|
758
|
|
|
$this->object->dataReset(); |
759
|
|
|
$this->assertEquals('', $this->object->__toString()); |
760
|
|
|
} |
761
|
|
|
|
762
|
|
|
/** |
763
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::draw |
764
|
|
|
*/ |
765
|
|
|
public function testDraw($whatWant = NULL) |
766
|
|
|
{ |
767
|
|
|
$this->object->setDataValue('kod', 'test'); |
768
|
|
|
$this->assertEquals('code:test', $this->object->draw()); |
769
|
|
|
} |
770
|
|
|
|
771
|
|
|
/** |
772
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getColumnsInfo |
773
|
|
|
*/ |
774
|
|
|
public function testgetColumnsInfo() |
775
|
|
|
{ |
776
|
|
|
switch ($this->object->getEvidence()) { |
777
|
|
|
case '': |
778
|
|
|
case 'c': |
779
|
|
|
case 'hooks': |
780
|
|
|
case 'status': |
781
|
|
|
case 'changes': |
782
|
|
|
case 'evidence-list': |
783
|
|
|
$this->assertNull($this->object->getColumnsInfo()); |
784
|
|
|
break; |
785
|
|
|
default: |
786
|
|
|
$this->assertNotEmpty($this->object->getColumnsInfo(), |
787
|
|
|
'Cannot obtain structure for '.$this->object->getEvidence()); |
788
|
|
|
break; |
789
|
|
|
} |
790
|
|
|
} |
791
|
|
|
|
792
|
|
|
/** |
793
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getActionsInfo |
794
|
|
|
*/ |
795
|
|
|
public function testgetActionsInfo() |
796
|
|
|
{ |
797
|
|
|
switch ($this->object->getEvidence()) { |
798
|
|
|
case '': |
799
|
|
|
case 'c': |
800
|
|
|
case 'hooks': |
801
|
|
|
case 'status': |
802
|
|
|
case 'changes': |
803
|
|
|
case 'nastaveni': |
804
|
|
|
case 'evidence-list': |
805
|
|
|
$this->assertNull($this->object->getActionsInfo()); |
806
|
|
|
$this->assertNotEmpty($this->object->getActionsInfo('faktura-vydana'), |
807
|
|
|
'Cannot obtain actions for na evidence'); |
808
|
|
|
break; |
809
|
|
|
default: |
810
|
|
|
$this->assertNotEmpty($this->object->getActionsInfo(), |
811
|
|
|
'Cannot obtain actions for '.$this->object->getEvidence()); |
812
|
|
|
break; |
813
|
|
|
} |
814
|
|
|
} |
815
|
|
|
|
816
|
|
|
/** |
817
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getRelationsInfo |
818
|
|
|
*/ |
819
|
|
|
public function testgetRelationsInfo() |
820
|
|
|
{ |
821
|
|
|
switch ($this->object->getEvidence()) { |
822
|
|
|
case '': |
823
|
|
|
case 'c': |
824
|
|
|
case 'hooks': |
825
|
|
|
case 'status': |
826
|
|
|
case 'changes': |
827
|
|
|
case 'nastaveni': |
828
|
|
|
case 'strom-cenik': |
829
|
|
|
case 'ucetni-obdobi': |
830
|
|
|
case 'evidence-list': |
831
|
|
|
$this->assertNull($this->object->getRelationsInfo()); |
832
|
|
|
break; |
833
|
|
|
default: |
834
|
|
|
$this->assertNotEmpty($this->object->getRelationsInfo(), |
835
|
|
|
'Cannot obtain relations for '.$this->object->getEvidence()); |
836
|
|
|
break; |
837
|
|
|
} |
838
|
|
|
} |
839
|
|
|
|
840
|
|
|
/** |
841
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getEvidenceUrl |
842
|
|
|
*/ |
843
|
|
|
public function testgetEvidenceUrl() |
844
|
|
|
{ |
845
|
|
|
$this->assertNotEmpty($this->object->getEvidenceUrl()); |
846
|
|
|
$this->assertNotEmpty($this->object->getEvidenceUrl('/properties')); |
|
|
|
|
847
|
|
|
} |
848
|
|
|
|
849
|
|
|
/** |
850
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::evidenceToClassName |
851
|
|
|
*/ |
852
|
|
|
public function testevidenceToClassName() |
853
|
|
|
{ |
854
|
|
|
$this->assertEquals('FakturaVydana', |
855
|
|
|
$this->object->evidenceToClassName('faktura-vydana')); |
856
|
|
|
} |
857
|
|
|
|
858
|
|
|
/** |
859
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getEvidenceInfo |
860
|
|
|
*/ |
861
|
|
View Code Duplication |
public function testGetEvidenceInfo() |
|
|
|
|
862
|
|
|
{ |
863
|
|
|
$eInfo = $this->object->getEvidenceInfo(); |
864
|
|
|
switch ($this->object->getEvidence()) { |
865
|
|
|
case '': |
866
|
|
|
case 'c': |
867
|
|
|
case 'hooks': |
868
|
|
|
case 'status': |
869
|
|
|
case 'changes': |
870
|
|
|
case 'nastaveni': |
871
|
|
|
case 'evidence-list': |
872
|
|
|
break; |
873
|
|
|
default: |
874
|
|
|
$this->assertArrayHasKey('evidencePath', $eInfo); |
875
|
|
|
break; |
876
|
|
|
} |
877
|
|
|
} |
878
|
|
|
|
879
|
|
|
/** |
880
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getEvidenceName |
881
|
|
|
*/ |
882
|
|
View Code Duplication |
public function testGetEvidenceName() |
|
|
|
|
883
|
|
|
{ |
884
|
|
|
$evidenceName = $this->object->getEvidenceName(); |
885
|
|
|
switch ($this->object->getEvidence()) { |
886
|
|
|
case '': |
887
|
|
|
case 'c': |
888
|
|
|
case 'hooks': |
889
|
|
|
case 'status': |
890
|
|
|
case 'changes': |
891
|
|
|
case 'nastaveni': |
892
|
|
|
case 'evidence-list': |
893
|
|
|
break; |
894
|
|
|
default: |
895
|
|
|
$this->assertNotEmpty($evidenceName); |
896
|
|
|
break; |
897
|
|
|
} |
898
|
|
|
} |
899
|
|
|
|
900
|
|
|
/** |
901
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::saveResponseToFile |
902
|
|
|
*/ |
903
|
|
|
public function testSaveResponseToFile() |
904
|
|
|
{ |
905
|
|
|
$tmp = sys_get_temp_dir().'/'.tmpfile(); |
906
|
|
|
$this->object->saveResponseToFile($tmp); |
907
|
|
|
$this->assertFileExists($tmp); |
908
|
|
|
} |
909
|
|
|
|
910
|
|
|
/** |
911
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getFirstRecordID() |
912
|
|
|
*/ |
913
|
|
View Code Duplication |
public function testgetFirstRecordID() |
|
|
|
|
914
|
|
|
{ |
915
|
|
|
switch ($this->object->getEvidence()) { |
916
|
|
|
case '': |
917
|
|
|
case 'c': |
918
|
|
|
case 'hooks': |
919
|
|
|
case 'status': |
920
|
|
|
case 'changes': |
921
|
|
|
case 'nastaveni': |
922
|
|
|
case 'evidence-list': |
923
|
|
|
break; |
924
|
|
|
default: |
925
|
|
|
$firstID = $this->object->getFirstRecordID(); |
|
|
|
|
926
|
|
|
break; |
927
|
|
|
} |
928
|
|
|
} |
929
|
|
|
|
930
|
|
|
/** |
931
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::getVazby |
932
|
|
|
* @expectedException \Exception |
933
|
|
|
*/ |
934
|
|
View Code Duplication |
public function testGetVazby() |
|
|
|
|
935
|
|
|
{ |
936
|
|
|
switch ($this->object->getEvidence()) { |
937
|
|
|
case '': |
938
|
|
|
case 'c': |
939
|
|
|
case 'hooks': |
940
|
|
|
case 'status': |
941
|
|
|
case 'changes': |
942
|
|
|
case 'nastaveni': |
943
|
|
|
case 'evidence-list': |
944
|
|
|
break; |
945
|
|
|
default: |
946
|
|
|
$this->object->getVazby($this->object->getMyKey()); |
947
|
|
|
break; |
948
|
|
|
} |
949
|
|
|
$this->object->getVazby(); |
950
|
|
|
} |
951
|
|
|
|
952
|
|
|
/** |
953
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::evidenceUrlWithSuffix |
954
|
|
|
*/ |
955
|
|
|
public function testEvidenceUrlWithSuffix() |
956
|
|
|
{ |
957
|
|
|
$urlraw = $this->object->getEvidenceURL(); |
958
|
|
|
$lala = $this->object->evidenceUrlWithSuffix('lala'); |
959
|
|
|
$this->assertEquals($urlraw.'/lala', $lala); |
960
|
|
|
$lolo = $this->object->evidenceUrlWithSuffix('?lele'); |
961
|
|
|
$this->assertEquals($urlraw.'?lele', $lolo); |
962
|
|
|
$lulu = $this->object->evidenceUrlWithSuffix(';lulu'); |
963
|
|
|
$this->assertEquals($urlraw.';lulu', $lulu); |
964
|
|
|
} |
965
|
|
|
|
966
|
|
|
/** |
967
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::join |
968
|
|
|
* @expectedException \Ease\Exception |
969
|
|
|
*/ |
970
|
|
|
public function testJoin() |
971
|
|
|
{ |
972
|
|
|
$this->assertTrue($this->object->join(new FlexiBeeRO(['id' => 'A'], |
973
|
|
|
['evidence' => 'adresar']))); |
974
|
|
|
$this->assertTrue($this->object->join(new FlexiBeeRO(['id' => 'B'], |
975
|
|
|
['evidence' => 'adresar']))); |
976
|
|
|
$this->object->join(new \stdClass()); |
|
|
|
|
977
|
|
|
} |
978
|
|
|
|
979
|
|
|
/** |
980
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::addUrlParams |
981
|
|
|
*/ |
982
|
|
|
public function testAddUrlParams() |
983
|
|
|
{ |
984
|
|
|
$this->assertEquals('http://vitexsoftware.cz/path?id=1&a=b', |
985
|
|
|
$this->object->addUrlParams('http://vitexsoftware.cz/path?a=b', |
986
|
|
|
['id' => 1], TRUE)); |
987
|
|
|
} |
988
|
|
|
|
989
|
|
|
/** |
990
|
|
|
* @covers FlexiPeeHP\FlexiBeeRO::addDefaultUrlParams |
991
|
|
|
*/ |
992
|
|
|
public function testAddDefaultUrlParams() |
993
|
|
|
{ |
994
|
|
|
$this->object->defaultUrlParams = []; |
995
|
|
|
$this->assertEquals('http://vitexsoftware.cz?a=b', |
996
|
|
|
$this->object->addDefaultUrlParams('http://vitexsoftware.cz?a=b')); |
997
|
|
|
$this->object->defaultUrlParams['id'] = 1; |
998
|
|
|
$this->assertEquals('http://vitexsoftware.cz/path?a=b&id=1', |
999
|
|
|
$this->object->addDefaultUrlParams('http://vitexsoftware.cz/path?a=b')); |
1000
|
|
|
} |
1001
|
|
|
|
1002
|
|
|
public function testFlexiDateToDateTime() |
1003
|
|
|
{ |
1004
|
|
|
$this->assertEquals(1495749600, |
1005
|
|
|
FlexiBeeRO::flexiDateToDateTime('2017-05-26+02:00')->getTimestamp()); |
1006
|
|
|
} |
1007
|
|
|
|
1008
|
|
|
public function testFlexiDateTimeToDateTime() |
1009
|
|
|
{ |
1010
|
|
|
$this->assertEquals(1506412853, |
1011
|
|
|
FlexiBeeRO::flexiDateTimeToDateTime('2017-09-26T10:00:53.755+02:00')->getTimestamp()); |
1012
|
|
|
} |
1013
|
|
|
} |
1014
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: