Passed
Push — master ( 6d8a3f...ef71b6 )
by Vítězslav
03:10
created

FlexiBeeROTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 2
c 0
b 0
f 0
rs 10
cc 1
eloc 0
nc 1
nop 0
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\SandTest
11
{
12
    /**
13
     * @var FlexiBeeRO
14
     */
15
    protected $object;
16
17
    /**
18
     * Example JSON 
19
     * @var string json 
20
     */
21
    public $json = '{"winstrom":{"@version":"1.0","adresar":[{"id":"2574","kontakty":[{"id":"299"}]}]}}';
22
23
    /**
24
     * Example XML
25
     * @var string xml 
26
     */
27
    public $xml = '<?xml version="1.0" encoding="utf-8"?>
28
29
<winstrom version="1.0">
30
  <!-- Adresář -->
31
  <adresar>
32
    <!-- ID (celé číslo) - -->
33
    <id>2574</id>
34
    <kontakty>
35
      <!-- Kontakty -->
36
      <kontakt>
37
        <!-- ID (celé číslo) - -->
38
        <id>299</id>
39
      </kontakt>
40
    </kontakty>
41
  </adresar>
42
</winstrom>';
43
44
    /**
45
     * Sets up the fixture, for example, opens a network connection.
46
     * This method is called before a test is executed.
47
     * @covers FlexiPeeHP\FlexiBeeRO::__construct
48
     */
49
    protected function setUp()
50
    {
51
        $this->object                  = new FlexiBeeRO();
52
        $this->object->prefix          = '/';
53
        $this->object->debug           = true;
54
        $this->object->reportRecipient = '[email protected]';
55
    }
56
57
    /**
58
     * Tears down the fixture, for example, closes a network connection.
59
     * This method is called after a test is executed.
60
     */
61
    protected function tearDown()
62
    {
63
        
64
    }
65
66
    /**
67
     * @covers FlexiPeeHP\FlexiBeeRO::logBanner
68
     */
69
    public function testLogBanner()
70
    {
71
        $this->object->logBanner(addslashes(get_class($this)));
72
    }
73
74
    /**
75
     * Test Constructor
76
     *
77
     * @depends testLogBanner
78
     * @covers FlexiPeeHP\FlexiBeeRO::__construct
79
     */
80
    public function testConstructor()
81
    {
82
        $classname = get_class($this->object);
83
        $evidence  = $this->object->getEvidence();
84
85
        // Get mock, without the constructor being called
86
        $mock = $this->getMockBuilder($classname)
87
            ->disableOriginalConstructor()
88
            ->getMockForAbstractClass();
89
        $mock->__construct(1, ['debug' => false]);
90
91
        if (!isset(\FlexiPeeHP\EvidenceList::$name[$evidence])) {
92
            $evidence = 'adresar';
93
        }
94
95
        $mock->__construct('',
96
            [
97
                'company' => constant('FLEXIBEE_COMPANY'),
98
                'url' => constant('FLEXIBEE_URL'),
99
                'user' => constant('FLEXIBEE_LOGIN'),
100
                'password' => constant('FLEXIBEE_PASSWORD'),
101
                'debug' => true,
102
                'prefix' => 'c',
103
                'evidence' => $evidence]);
104
    }
105
106
    /**
107
     * @covers FlexiPeeHP\FlexiBeeRO::curlInit
108
     */
109
    public function testCurlInit()
110
    {
111
        $this->object->timeout = 120;
112
        $this->object->curlInit();
113
        $this->assertTrue(is_resource($this->object->curl));
114
    }
115
116
    /**
117
     * @covers FlexiPeeHP\FlexiBeeRO::processInit
118
     */
119
    public function testProcessInit()
120
    {
121
        $this->object->processInit(1);
122
        $this->object->processInit(['id' => 1]);
123
        $this->assertEquals(1, $this->object->getDataValue('id'));
124
125
        if (!is_null($this->object->evidence) && $this->object->evidence != 'test') {
0 ignored issues
show
introduced by
The condition is_null($this->object->evidence) is always false.
Loading history...
126
127
128
            $firstID = $this->object->getColumnsFromFlexibee(['id', 'kod'],
129
                ['limit' => 1]);
130
131
            if (count($firstID) && isset($firstID[0]['id'])) {
132
133
                $this->object->processInit((int) current($firstID));
134
                $this->assertNotEmpty($this->object->__toString());
135
136
                if (isset($firstID[0]['kod'])) {
137
                    $this->object->processInit('code:'.$firstID[0]['kod']);
138
                    $this->assertNotEmpty($this->object->__toString());
139
                }
140
141
                $this->object->processInit($this->object->getEvidenceURL().'/'.$firstID[0]['id'].'.xml');
142
            } else {
143
                $this->markTestSkipped(sprintf('Evidence %s does not contain first record',
144
                        $this->object->getEvidence()));
145
            }
146
        }
147
    }
148
149
    /**
150
     * @covers FlexiPeeHP\FlexiBeeRO::setUp
151
     */
152
    public function testSetUp()
153
    {
154
        $this->object->authSessionId = 'XXXtestXXX';
155
        $this->object->setUp(
156
            [
157
                'company' => 'cmp',
158
                'url' => 'url',
159
                'user' => 'usr',
160
                'password' => 'pwd',
161
                'prefix' => 'c',
162
                'debug' => true,
163
                'defaultUrlParams' => ['limit' => 10],
164
                'evidence' => 'smlouva',
165
                'detail' => 'summary',
166
                'filter' => 'testfilter',
167
                'ignore404' => true,
168
                'offline' => true
169
            ]
170
        );
171
        $this->assertEquals('cmp', $this->object->company);
172
        $this->assertEquals('url', $this->object->url);
173
        $this->assertEquals('usr', $this->object->user);
174
        $this->assertEquals('/c/', $this->object->prefix);
175
        $this->assertEquals('pwd', $this->object->password);
176
    }
177
178
    /**
179
     * @covers FlexiPeeHP\FlexiBeeRO::getConnectionOptions
180
     */
181
    public function testGetConnectionOptions()
182
    {
183
        $options                     = $this->object->getConnectionOptions();
184
        $this->assertArrayHasKey('url', $options);
185
        $this->object->timeout       = 120;
186
        $this->object->authSessionId = 'sessid';
187
        $this->object->setCompany('test');
188
        $this->object->getConnectionOptions();
189
    }
190
191
    /**
192
     * @covers FlexiPeeHP\FlexiBeeRO::setPrefix
193
     * @expectedException \Exception
194
     */
195
    public function testSetPrefix()
196
    {
197
        $this->object->setPrefix('c');
198
        $this->assertEquals('/c/', $this->object->prefix);
199
        $this->object->setPrefix(null);
200
        $this->assertEquals('', $this->object->prefix);
201
        $this->object->setPrefix('fail');
202
    }
203
204
    /**
205
     * @covers FlexiPeeHP\FlexiBeeRO::setFormat
206
     */
207
    public function testSetFormat()
208
    {
209
        $this->object->setFormat('xml');
210
        $this->assertEquals('xml', $this->object->format);
211
    }
212
213
    /**
214
     * We can set only evidence defined in EvidenceList class
215
     *
216
     * @covers FlexiPeeHP\FlexiBeeRO::setEvidence
217
     * @expectedException \Exception
218
     */
219
    public function testSetEvidence()
220
    {
221
        $this->object->setEvidence('adresar');
222
        $this->assertEquals('adresar', $this->object->evidence);
223
        $this->object->setPrefix('c');
224
        $this->object->debug = true;
225
        $this->object->setEvidence('fail');
226
    }
227
228
    /**
229
     * @covers FlexiPeeHP\FlexiBeeRO::setCompany
230
     */
231
    public function testSetCompany()
232
    {
233
        $this->object->setCompany('test_s_r_o_');
234
        $this->assertEquals('test_s_r_o_', $this->object->company);
235
    }
236
237
    /**
238
     * @covers FlexiPeeHP\FlexiBeeRO::object2array
239
     */
240
    public function testObject2array()
241
    {
242
        $this->assertNull($this->object->object2array(new \stdClass()));
243
        $this->assertEquals(
244
            [
245
                'item' => 1,
246
                'arrItem' => ['a', 'b' => 'c']
247
            ]
248
            , $this->object->object2array(new \Test\ObjectForTesting()));
249
    }
250
251
    /**
252
     * @covers FlexiPeeHP\FlexiBeeRO::objectToID
253
     */
254
    public function testObjectToID()
255
    {
256
        $this->object->setDataValue('kod', 'TEST');
257
        $this->assertEquals('code:TEST',
258
            $this->object->objectToID($this->object));
259
260
        $this->assertEquals('TEST', $this->object->objectToID('TEST'));
0 ignored issues
show
Bug introduced by
'TEST' of type string is incompatible with the type object|array expected by parameter $object of FlexiPeeHP\FlexiBeeRO::objectToID(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

260
        $this->assertEquals('TEST', $this->object->objectToID(/** @scrutinizer ignore-type */ 'TEST'));
Loading history...
261
    }
262
263
    /**
264
     * @covers FlexiPeeHP\FlexiBeeRO::performRequest
265
     */
266
    public function testPerformRequest()
267
    {
268
        $evidence = $this->object->getEvidence();
269
        switch ($evidence) {
270
            case null:
271
            case '':
272
            case 'c':
273
            case 'test':
274
            case 'status':
275
            case 'nastaveni':
276
                $this->object->performRequest(null, 'GET', 'xml');
277
                break;
278
279
            default:
280
                $this->object->performRequest(null, 'GET', 'json');
281
                $this->object->performRequest(null, 'GET', 'xml');
282
                break;
283
        }
284
285
        //404 Test
286
287
        $notFound = $this->object->performRequest('error404.json');
288
        if (array_key_exists('message', $notFound)) {
289
            $this->assertEquals('false', $notFound['success']);
290
        } else {
291
            echo '';
292
        }
293
    }
294
295
    /**
296
     * @covers FlexiPeeHP\FlexiBeeRO::rawResponseToArray
297
     */
298
    public function testRawResponseToArray()
299
    {
300
301
        $this->assertTrue(is_array(
302
                $this->object->rawResponseToArray($this->json, 'json')));
303
        $this->assertTrue(is_array(
304
                $this->object->rawResponseToArray($this->xml, 'xml')));
305
        $this->assertTrue(is_array(
306
                $this->object->rawResponseToArray('simpletext', 'txt')));
307
        $this->assertTrue(is_array(
308
                $this->object->rawResponseToArray('othertext', 'other')));
309
    }
310
311
    /**
312
     * @covers FlexiPeeHP\FlexiBeeRO::rawJsonToArray
313
     */
314
    public function testRawJsonToArray()
315
    {
316
        $this->assertNull($this->object->rawJsonToArray($this->json.'XXX'));
317
        $evidence    = $this->object->getResponseEvidence() ? $this->object->getResponseEvidence()
318
                : 'adresar';
319
        $arrayWeWant = [
320
            '@version' => '1.0',
321
            $evidence =>
322
            [
323
                [
324
                    'id' => '2574',
325
                    'kontakty' =>
326
                    [
327
                        ['id' => '299']
328
                    ]
329
                ]
330
            ]
331
        ];
332
        $this->assertEquals($arrayWeWant,
333
            $this->object->rawJsonToArray($this->json));
334
    }
335
336
    /**
337
     * @covers FlexiPeeHP\FlexiBeeRO::rawXmlToArray
338
     */
339
    public function testRawXmlToArray()
340
    {
341
        $evidence    = $this->object->getResponseEvidence() ? $this->object->getResponseEvidence()
342
                : 'adresar';
343
        $arrayWeWant = [
344
            '@version' => '1.0',
345
            $evidence =>
346
            [
347
                [
348
                    'id' => '2574',
349
                    'kontakty' =>
350
                    [
351
                        ['kontakt' => [
352
                                ['id' => '299']
353
                            ]
354
                        ]
355
                    ]
356
                ]
357
            ]
358
        ];
359
        $this->assertEquals($arrayWeWant,
360
            $this->object->rawXmlToArray($this->xml));
361
    }
362
363
    /**
364
     * @covers FlexiPeeHP\FlexiBeeRO::parseResponse
365
     */
366
    public function testParseResponse()
367
    {
368
        $this->object->parseResponse($this->object->rawJsonToArray($this->json),
369
            200);
370
    }
371
372
    /**
373
     * @covers FlexiPeeHP\FlexiBeeRO::doCurlRequest
374
     */
375
    public function testDoCurlRequest()
376
    {
377
        $this->object->doCurlRequest(constant('FLEXIBEE_URL'), 'GET');
378
    }
379
380
    /**
381
     * @covers FlexiPeeHP\FlexiBeeRO::setAction
382
     */
383
    public function testSetAction()
384
    {
385
        switch ($this->object->getEvidence()) {
386
            case '':
387
            case 'c':
388
            case 'hooks':
389
            case 'status':
390
            case 'changes':
391
            case 'nastaveni':
392
            case 'evidence-list':
393
                $this->object->setAction('none');
394
                break;
395
            default:
396
                $this->assertTrue($this->object->setAction('new'));
397
                $this->object->actionsAvailable = [];
398
                $this->assertFalse($this->object->setAction('none'));
399
                $this->object->actionsAvailable = ['copy'];
400
                $this->assertFalse($this->object->setAction('none'));
401
                break;
402
        }
403
    }
404
405
    /**
406
     * @covers FlexiPeeHP\FlexiBeeRO::getEvidence
407
     */
408
    public function testGetEvidence()
409
    {
410
        $this->assertEquals($this->object->evidence,
411
            $this->object->getEvidence());
412
    }
413
414
    /**
415
     * @covers FlexiPeeHP\FlexiBeeRO::getCompany
416
     */
417
    public function testGetCompany()
418
    {
419
        $this->assertEquals($this->object->company, $this->object->getCompany());
420
    }
421
422
    /**
423
     * @covers FlexiPeeHP\FlexiBeeRO::getResponseEvidence
424
     */
425
    public function testGetResponseEvidence()
426
    {
427
        $responseEvidence = $this->object->getResponseEvidence();
428
        switch ($this->object->getEvidence()) {
429
            case '':
430
            case 'c':
431
            case 'hooks':
432
            case 'status':
433
            case 'changes':
434
            case 'nastaveni':
435
            case 'evidence-list':
436
                break;
437
            default:
438
                $this->assertEquals($this->object->getEvidence(),
439
                    $responseEvidence);
440
                break;
441
        }
442
    }
443
444
    /**
445
     * @covers FlexiPeeHP\FlexiBeeRO::getLastInsertedId
446
     * @depends testInsertToFlexiBee
447
     */
448
    public function testGetLastInsertedId()
449
    {
450
        $this->assertNotEmpty($this->object->getLastInsertedId());
0 ignored issues
show
Bug introduced by
The method getLastInsertedId() does not exist on FlexiPeeHP\FlexiBeeRO. It seems like you code against a sub-type of FlexiPeeHP\FlexiBeeRO such as FlexiPeeHP\FlexiBeeRW. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

450
        $this->assertNotEmpty($this->object->/** @scrutinizer ignore-call */ getLastInsertedId());
Loading history...
451
    }
452
453
    /**
454
     * @covers FlexiPeeHP\FlexiBeeRO::xml2array
455
     */
456
    public function testXml2array()
457
    {
458
        $arrayWeWant = [
459
            '@version' => '1.0',
460
            'adresar' =>
461
            [
462
                [
463
                    'id' => '2574',
464
                    'kontakty' =>
465
                    [
466
                        ['kontakt' => [
467
                                ['id' => '299']
468
                            ]
469
                        ]
470
                    ]
471
                ]
472
            ]
473
        ];
474
475
        $this->assertEquals($arrayWeWant, $this->object->xml2array($this->xml));
476
    }
477
478
    /**
479
     * @covers FlexiPeeHP\FlexiBeeRO::extractUrlParams
480
     */
481
    public function testExtractUrlParams()
482
    {
483
        $conditions = ['id' => 23, 'limit' => 10];
484
        $this->object->extractUrlParams($conditions, $urlParams);
485
        $this->assertEquals(['id' => 23], $conditions);
486
        $this->assertEquals(['limit' => 10], $urlParams);
487
    }
488
489
    /**
490
     * @covers FlexiPeeHP\FlexiBeeRO::urlEncode
491
     */
492
    public function testUrlEncode()
493
    {
494
        $this->assertEquals("stitky%3D'code:VIP'%20or%20stitky%3D'code:DULEZITE'",
495
            FlexiBeeRO::urlEncode("stitky='code:VIP' or stitky='code:DULEZITE'"));
496
    }
497
498
    /**
499
     * @covers FlexiPeeHP\FlexiBeeRO::getAllFromFlexibee
500
     */
501
    public function testGetAllFromFlexibee()
502
    {
503
        $this->object->getAllFromFlexibee();
504
    }
505
506
    /**
507
     * @covers FlexiPeeHP\FlexiBeeRO::disconnect
508
     *
509
     * @depends testPerformRequest
510
     * @depends testLoadFlexiData
511
     * @depends testGetFlexiRow
512
     * @depends testGetFlexiData
513
     * @depends testLoadFromFlexiBee
514
     * @depends testInsertToFlexiBee
515
     * @depends testIdExists
516
     * @depends testRecordExists
517
     * @depends testGetColumnsFromFlexibee
518
     * @depends testSearchString
519
     */
520
    public function testDisconnect()
521
    {
522
        $this->object->disconnect();
523
        $this->assertNull($this->object->curl);
524
    }
525
526
    /**
527
     * @covers FlexiPeeHP\FlexiBeeRO::__destruct
528
     * @depends testDisconnect
529
     */
530
    public function testdestruct()
531
    {
532
        $this->markTestSkipped();
533
    }
534
535
    /**
536
     * @covers FlexiPeeHP\FlexiBeeRO::getFlexiRow
537
     */
538
    public function testGetFlexiRow()
539
    {
540
        $this->object->getFlexiRow(0);
541
        $this->object->getFlexiRow(1);
542
    }
543
544
    /**
545
     * @covers FlexiPeeHP\FlexiBeeRO::getFlexiData
546
     */
547
    public function testGetFlexiData()
548
    {
549
        $evidence = $this->object->getEvidence();
550
        switch ($evidence) {
551
            case null:
552
                $this->object->getFlexiData();
553
                break;
554
            case 'c':
555
                $this->object->evidence  = 'c';
556
                $this->object->prefix    = '';
557
                $this->object->company   = '';
558
                $this->object->nameSpace = 'companies';
559
                $flexidata               = $this->object->getFlexiData();
560
                $this->assertArrayHasKey('company', $flexidata);
561
                break;
562
            case 'evidence-list':
563
                $flexidata               = $this->object->getFlexiData(null,
564
                    ['detail' => 'id']);
565
                $this->assertArrayHasKey('evidenceType', $flexidata[0]);
566
                break;
567
568
            default:
569
                $flexidata = $this->object->getFlexiData(null,
570
                    ['detail' => 'id']);
571
572
                if (is_array($flexidata)) {
0 ignored issues
show
introduced by
The condition is_array($flexidata) is always true.
Loading history...
573
                    if (count($flexidata)) {
574
                        $this->markTestSkipped('Empty evidence');
575
                    } else {
576
                        $this->assertArrayHasKey(0, $flexidata);
577
578
                        $this->assertArrayHasKey('id', $flexidata[0]);
579
                        $filtrered = $this->object->getFlexiData(null,
580
                            ["id = ".$flexidata[0]['id'], 'detail' => 'full']);
581
                        $this->assertArrayHasKey(0, $filtrered);
582
                        $this->assertArrayHasKey('id', $filtrered[0]);
583
                    }
584
                }
585
                break;
586
        }
587
    }
588
589
    /**
590
     * @covers FlexiPeeHP\FlexiBeeRO::loadFromFlexiBee
591
     */
592
    public function testLoadFromFlexiBee()
593
    {
594
        $this->object->loadFromFlexiBee();
595
        $this->object->loadFromFlexiBee(222);
596
    }
597
598
    /**
599
     * @covers FlexiPeeHP\FlexiBeeRO::getJsonizedData
600
     */
601
    public function testGetJsonizedData()
602
    {
603
        $this->assertEquals('{"'.$this->object->nameSpace.'":{"@version":"1.0","'.$this->object->evidence.'":{"key":"value"}}}',
604
            $this->object->getJsonizedData(['key' => 'value']));
605
606
        switch ($this->object->getEvidence()) {
607
            case '':
608
            case 'c':
609
            case 'hooks':
610
            case 'status':
611
            case 'changes':
612
            case 'nastaveni':
613
            case 'evidence-list':
614
                $this->object->getJsonizedData(['key' => 'value']);
615
                break;
616
            default:
617
                $this->object->setAction('copy');
618
                $this->assertEquals('{"'.$this->object->nameSpace.'":{"@version":"1.0","'.$this->object->evidence.'":{"key":"value"},"'.$this->object->evidence.'@action":"copy"}}',
619
                    $this->object->getJsonizedData(['key' => 'value']));
620
621
                $this->object->action = 'storno';
0 ignored issues
show
Bug introduced by
The property action is declared protected in FlexiPeeHP\FlexiBeeRO and cannot be accessed from this context.
Loading history...
622
                $this->object->filter = "stavUhrK = 'stavUhr.uhrazeno'";
623
                $this->object->getJsonizedData([]);
624
                break;
625
        }
626
    }
627
628
    /**
629
     * @covers FlexiPeeHP\FlexiBeeRO::getDataForJSON
630
     */
631
    public function testGetDataForJson()
632
    {
633
        $this->object->getDataForJSON();
634
    }
635
636
    /**
637
     * @covers FlexiPeeHP\FlexiBeeRO::idExists
638
     */
639
    public function testIdExists()
640
    {
641
        $this->assertFalse($this->object->idExists('nonexistent'));
642
        switch ($this->object->getEvidence()) {
643
            case '':
644
            case 'c':
645
            case 'hooks':
646
            case 'status':
647
            case 'changes':
648
            case 'nastaveni':
649
            case 'evidence-list':
650
                break;
651
            default:
652
                $first = $this->object->getColumnsFromFlexibee(['id'],
653
                    ['limit' => 1], 'id');
654
                if (empty($first)) {
655
                    $this->markTestSkipped('empty evidence ?');
656
                } else {
657
                    $this->object->setData($first);
658
                    $this->assertTrue($this->object->idExists());
659
                }
660
                break;
661
        }
662
    }
663
664
    /**
665
     * @covers FlexiPeeHP\FlexiBeeRO::getRecordID
666
     */
667
    public function testGetRecordID()
668
    {
669
        $this->object->setData([$this->object->getKeyColumn() => 10]);
670
        $this->assertEquals(10, $this->object->getRecordID());
671
    }
672
673
    /**
674
     * @covers FlexiPeeHP\FlexiBeeRO::recordExists
675
     */
676
    public function testRecordExists()
677
    {
678
        $evidence = $this->object->getEvidence();
679
680
        switch ($evidence) {
681
            case null:
682
            case 'c':
683
            case 'status':
684
            case 'evidence-list':
685
                $this->object->recordExists();
686
                break;
687
688
            default:
689
                $flexidata = $this->object->getFlexiData(null,
690
                    ['limit' => 1, 'detail' => 'id']);
691
                if (is_array($flexidata) && !count($flexidata)) {
692
                    $this->assertFalse($this->object->recordExists(['id' => 1]),
693
                        'Record ID 1 exists in empty evidence ?');
694
                } else {
695
                    if (!is_null($flexidata)) {
696
                        $this->object->setData(['id' => (int) $flexidata[0]['id']]);
697
                        $this->assertTrue($this->object->recordExists(),
698
                            'First record exists test failed');
699
                        $this->assertFalse($this->object->recordExists(['id' => 0]),
700
                            'Record ID 0 exists');
701
                        $this->assertFalse($this->object->recordExists(['unexistent' => 1]),
702
                            'Unexistent Record exist ?');
703
                    }
704
                }
705
                break;
706
        }
707
    }
708
709
    /**
710
     * @covers FlexiPeeHP\FlexiBeeRO::getColumnsFromFlexibee
711
     */
712
    public function testGetColumnsFromFlexibee()
713
    {
714
715
        switch ($this->object->getEvidence()) {
716
            case '':
717
            case 'c':
718
            case 'hooks':
719
            case 'status':
720
            case 'changes':
721
            case 'nastaveni':
722
            case 'evidence-list':
723
                break;
724
            default:
725
                $this->object->getColumnsFromFlexibee(['id', 'kod'],
726
                    ['limit' => 1], 'id');
727
                $this->object->getColumnsFromFlexibee('summary', ['limit' => 1],
0 ignored issues
show
Bug introduced by
'summary' of type string is incompatible with the type string[] expected by parameter $columnsList of FlexiPeeHP\FlexiBeeRO::getColumnsFromFlexibee(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

727
                $this->object->getColumnsFromFlexibee(/** @scrutinizer ignore-type */ 'summary', ['limit' => 1],
Loading history...
728
                    'id');
729
730
                break;
731
        }
732
    }
733
734
    /**
735
     * @covers FlexiPeeHP\FlexiBeeRO::getExternalID
736
     */
737
    public function testGetExternalID()
738
    {
739
        $this->assertTrue(empty($this->object->getExternalID('ext:test:10'))); //ext: does not exist
740
741
        $this->object->setDataValue('external-ids',
742
            ['ext:doe:22', 'ext:test:10']);
743
744
        $this->assertEquals('ext:doe:22', $this->object->getExternalID());
745
        $this->assertEquals('10', $this->object->getExternalID('test'));
746
    }
747
748
    /**
749
     * @covers FlexiPeeHP\FlexiBeeRO::getGlobalVersion
750
     */
751
    public function testGetGlobalVersion()
752
    {
753
        switch ($this->object->getEvidence()) {
754
            case '':
755
            case 'c':
756
            case 'hooks':
757
            case 'status':
758
            case 'changes':
759
            case 'nastaveni':
760
            case 'evidence-list':
761
                $this->object->getGlobalVersion();
762
                break;
763
            default:
764
                $this->assertInternalType("int",
765
                    $this->object->getGlobalVersion(),
766
                    'error obtaining of GlobalVersion');
767
                break;
768
        }
769
    }
770
771
    /**
772
     * @covers FlexiPeeHP\FlexiBeeRO::getApiURL
773
     */
774
    public function testGetApiUrl()
775
    {
776
        $evidence = $this->object->getEvidence();
777
        if ($evidence) {
778
            $url = $this->object->url.'/c/'.constant('FLEXIBEE_COMPANY').'/'.$evidence;
779
        } else {
780
            $url = $this->object->url.'/c/'.constant('FLEXIBEE_COMPANY');
781
        }
782
783
        $this->assertEquals($url, $this->object->getApiURL());
784
        $this->assertEquals($url.'.html', $this->object->getApiURL('html'));
785
        $this->assertEquals($url.'.xml', $this->object->getApiURL('xml'));
786
    }
787
788
    /**
789
     * @covers FlexiPeeHP\FlexiBeeRO::getResponseFormat
790
     */
791
    public function testGetResponseFormat()
792
    {
793
        $this->object->performRequest(null, 'GET', 'json');
794
        $this->assertEquals('application/json',
795
            $this->object->getResponseFormat());
796
        $this->object->performRequest(null, 'GET', 'xml');
797
        $this->assertEquals('application/xml',
798
            $this->object->getResponseFormat());
799
        unset($this->object->curlInfo['content_type']);
800
        $this->assertNull($this->object->getResponseFormat());
801
    }
802
803
    /**
804
     * @covers FlexiPeeHP\FlexiBeeRO::getKod
805
     */
806
    public function testGetKod()
807
    {
808
        $testString = [];
809
        $this->assertEquals('code:CODE',
810
            $this->object->getKod([$this->object->keyColumn => 'code']));
811
812
        $testString[$this->object->nameColumn] = 'Fish clamp -  Úchytka pro instalaci samonosných kabelů '
813
            .'(3.5 mm)';
814
        $code0                                 = $this->object->getKod($testString);
815
        $this->assertEquals('code:FISHCLAMPUCHYTKAPR', $code0);
816
        $code1                                 = $this->object->getKod($testString,
817
            false);
818
        $this->assertEquals('code:FISHCLAMPUCHYTKAPR', $code1);
819
        $code2                                 = $this->object->getKod($testString);
820
        $this->assertEquals('code:FISHCLAMPUCHYTKAPR1', $code2);
821
        $this->object->setData($testString);
822
        $code3                                 = $this->object->getKod();
823
        $this->assertEquals('code:FISHCLAMPUCHYTKAPR2', $code3);
824
825
        $this->assertEquals('code:TEST',
826
            $this->object->getKod([$this->object->nameColumn => 'test']));
827
828
        $this->assertEquals('code:TEST1', $this->object->getKod('test'));
829
830
        $this->assertEquals('code:TEST2',
831
            $this->object->getKod(['kod' => 'test']));
832
        $this->assertEquals('code:NOTSET', $this->object->getKod(['kod' => '']));
833
    }
834
835
    /**
836
     * @covers FlexiPeeHP\FlexiBeeRO::logResult
837
     */
838
    public function testLogResult()
839
    {
840
        $this->object->cleanMessages();
841
        $success = json_decode('{"winstrom":{"@version":"1.0","success":"true",'
842
            .'"stats":{"created":"0","updated":"1","deleted":"0","skipped":"0"'
843
            .',"failed":"0"},"results":[{"id":"1","request-id":"ext:SōkoMan.item'
844
            .':5271","ref":"/c/spoje_net_s_r_o_1/skladovy-pohyb/1.json"}]}}');
845
        $this->object->logResult(current($this->object->object2array($success)),
846
            'http://test');
847
848
        $this->assertArrayHasKey('info', $this->object->getStatusMessages(true));
849
850
        $error                          = json_decode('{"winstrom":{"@version":"1.0","success":"false",'
851
            .'"stats":{"created":"0","updated":"0","deleted":"0","skipped":"0"'
852
            .',"failed":"0"},"results":[{"errors":[{"message":"cz.winstrom.'
853
            .'service.WSBusinessException: Zadaný kód není unikátní.\nZadaný'
854
            .' kód není unikátní."}]}]}}');
855
        $this->object->lastResponseCode = 500;
856
        $this->object->logResult(current($this->object->object2array($error)));
857
        $this->assertArrayHasKey('error', $this->object->getStatusMessages(true));
858
    }
859
860
    /**
861
     * @covers FlexiPeeHP\FlexiBeeRO::flexiUrl
862
     */
863
    public function testFlexiUrl()
864
    {
865
        $this->assertEquals("a eq '1' and b eq 'foo'",
866
            $this->object->flexiUrl(['a' => 1, 'b' => 'foo'], 'and'));
867
        $this->assertEquals("a eq '1' or b eq 'bar'",
868
            $this->object->flexiUrl(['a' => 1, 'b' => 'bar'], 'or'));
869
        $this->assertEquals("a eq true or b eq false",
870
            $this->object->flexiUrl(['a' => true, 'b' => false], 'or'));
871
        $this->assertEquals("a is null and b is not null",
872
            $this->object->flexiUrl(['a' => null, 'b' => '!null'], 'and'));
873
    }
874
875
    /**
876
     * @covers FlexiPeeHP\FlexiBeeRO::unifyResponseFormat
877
     */
878
    public function testunifyResponseFormat()
879
    {
880
        $this->assertNull($this->object->unifyResponseFormat(null));
881
        //One Row Test
882
883
        $responseEvidence = $this->object->getResponseEvidence();
884
        if (empty($responseEvidence)) {
885
            $responseEvidence       = $this->object->evidence = 'test';
886
        }
887
888
        $test1raw = [$responseEvidence =>
889
            ['id' => 1, 'name' => 'value']
890
        ];
891
892
        $test1expected = [$responseEvidence =>
893
            [
894
                ['id' => 1, 'name' => 'value']
895
            ]
896
        ];
897
898
        $this->assertEquals($test1expected,
899
            $this->object->unifyResponseFormat($test1raw));
900
901
        //Two Row Test
902
        $test2Raw = [$this->object->getResponseEvidence() =>
903
            [
904
                ['id' => 1, 'name' => 'value'],
905
                ['id' => 2, 'name' => 'value2']
906
            ]
907
        ];
908
909
        $test2expected = [$this->object->getResponseEvidence() =>
910
            [
911
                ['id' => 1, 'name' => 'value'],
912
                ['id' => 2, 'name' => 'value2']
913
            ]
914
        ];
915
916
        $this->assertEquals($test2expected,
917
            $this->object->unifyResponseFormat($test2Raw));
918
    }
919
920
    /**
921
     * @covers FlexiPeeHP\FlexiBeeRO::__toString
922
     */
923
    public function testtoString()
924
    {
925
        $id = '123';
926
        $this->object->setMyKey($id);
927
        $this->assertEquals($id, (string) $this->object);
928
929
        $this->object->setDataValue('kod', 'test');
930
        $this->assertEquals('code:TEST', (string) $this->object);
931
932
        $identifer = 'ext:test:123';
933
        $this->object->setMyKey($identifer);
934
        $this->assertEquals($identifer, (string) $this->object);
935
936
        $this->object->dataReset();
937
        $this->assertEquals('', $this->object->__toString());
938
    }
939
940
    /**
941
     * @covers FlexiPeeHP\FlexiBeeRO::draw
942
     */
943
    public function testDraw($whatWant = NULL)
944
    {
945
        $this->object->setDataValue('kod', 'test');
946
        $this->assertEquals('code:TEST', $this->object->draw());
947
    }
948
949
    /**
950
     * @covers FlexiPeeHP\FlexiBeeRO::getColumnsInfo
951
     */
952
    public function testgetColumnsInfo()
953
    {
954
        switch ($this->object->getEvidence()) {
955
            case '':
956
            case 'c':
957
            case 'hooks':
958
            case 'status':
959
            case 'changes':
960
            case 'evidence-list':
961
                $this->assertNull($this->object->getColumnsInfo());
962
                break;
963
            default:
964
                $this->assertNotEmpty($this->object->getColumnsInfo(),
965
                    'Cannot obtain structure for '.$this->object->getEvidence());
966
                break;
967
        }
968
    }
969
970
    /**
971
     * @covers FlexiPeeHP\FlexiBeeRO::getActionsInfo
972
     */
973
    public function testgetActionsInfo()
974
    {
975
        switch ($this->object->getEvidence()) {
976
            case '':
977
            case 'c':
978
            case 'hooks':
979
            case 'status':
980
            case 'changes':
981
            case 'nastaveni':
982
            case 'evidence-list':
983
                $this->assertNull($this->object->getActionsInfo());
984
                $this->assertNotEmpty($this->object->getActionsInfo('faktura-vydana'),
985
                    'Cannot obtain actions for na evidence');
986
                break;
987
            default:
988
                $this->assertNotEmpty($this->object->getActionsInfo(),
989
                    'Cannot obtain actions for '.$this->object->getEvidence());
990
                break;
991
        }
992
    }
993
994
    /**
995
     * @covers FlexiPeeHP\FlexiBeeRO::getRelationsInfo
996
     */
997
    public function testgetRelationsInfo()
998
    {
999
        switch ($this->object->getEvidence()) {
1000
            case '':
1001
            case 'c':
1002
            case 'hooks':
1003
            case 'status':
1004
            case 'changes':
1005
            case 'nastaveni':
1006
            case 'strom-cenik':
1007
            case 'ucetni-obdobi':
1008
            case 'evidence-list':
1009
                $this->assertNull($this->object->getRelationsInfo());
1010
                break;
1011
            default:
1012
                $this->assertNotEmpty($this->object->getRelationsInfo(),
1013
                    'Cannot obtain relations for '.$this->object->getEvidence());
1014
                break;
1015
        }
1016
    }
1017
1018
    /**
1019
     * @covers FlexiPeeHP\FlexiBeeRO::getEvidenceUrl
1020
     */
1021
    public function testgetEvidenceUrl()
1022
    {
1023
        $this->assertNotEmpty($this->object->getEvidenceUrl());
1024
        $this->assertNotEmpty($this->object->getEvidenceUrl('/properties'));
0 ignored issues
show
Unused Code introduced by
The call to FlexiPeeHP\FlexiBeeRO::getEvidenceURL() has too many arguments starting with '/properties'. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

1024
        $this->assertNotEmpty($this->object->/** @scrutinizer ignore-call */ getEvidenceUrl('/properties'));

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
1025
    }
1026
1027
    /**
1028
     * @covers FlexiPeeHP\FlexiBeeRO::evidenceToClassName
1029
     */
1030
    public function testevidenceToClassName()
1031
    {
1032
        $this->assertEquals('FakturaVydana',
1033
            $this->object->evidenceToClassName('faktura-vydana'));
1034
    }
1035
1036
    /**
1037
     * @covers FlexiPeeHP\FlexiBeeRO::getEvidenceInfo
1038
     */
1039
    public function testGetEvidenceInfo()
1040
    {
1041
        $eInfo = $this->object->getEvidenceInfo();
1042
        switch ($this->object->getEvidence()) {
1043
            case '':
1044
            case 'c':
1045
            case 'hooks':
1046
            case 'status':
1047
            case 'changes':
1048
            case 'nastaveni':
1049
            case 'evidence-list':
1050
                break;
1051
            default:
1052
                $this->assertArrayHasKey('evidencePath', $eInfo);
1053
                break;
1054
        }
1055
    }
1056
1057
    /**
1058
     * @covers FlexiPeeHP\FlexiBeeRO::getEvidenceName
1059
     */
1060
    public function testGetEvidenceName()
1061
    {
1062
        $evidenceName = $this->object->getEvidenceName();
1063
        switch ($this->object->getEvidence()) {
1064
            case '':
1065
            case 'c':
1066
            case 'hooks':
1067
            case 'status':
1068
            case 'changes':
1069
            case 'nastaveni':
1070
            case 'evidence-list':
1071
                break;
1072
            default:
1073
                $this->assertNotEmpty($evidenceName);
1074
                break;
1075
        }
1076
    }
1077
1078
    /**
1079
     * @covers FlexiPeeHP\FlexiBeeRO::saveResponseToFile
1080
     */
1081
    public function testSaveResponseToFile()
1082
    {
1083
        $tmp = sys_get_temp_dir().'/'.tmpfile();
0 ignored issues
show
Bug introduced by
Are you sure tmpfile() of type resource|false can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1083
        $tmp = sys_get_temp_dir().'/'./** @scrutinizer ignore-type */ tmpfile();
Loading history...
1084
        $this->object->saveResponseToFile($tmp);
1085
        $this->assertFileExists($tmp);
1086
    }
1087
1088
    /**
1089
     * @covers FlexiPeeHP\FlexiBeeRO::getFirstRecordID()
1090
     */
1091
    public function testgetFirstRecordID()
1092
    {
1093
        $this->object->getFirstRecordID();
1094
        switch ($this->object->getEvidence()) {
1095
            case '':
1096
            case 'c':
1097
            case 'hooks':
1098
            case 'status':
1099
            case 'changes':
1100
            case 'nastaveni':
1101
            case 'evidence-list':
1102
                break;
1103
            default:
1104
                break;
1105
        }
1106
    }
1107
1108
    /**
1109
     * @covers FlexiPeeHP\FlexiBeeRO::getVazby
1110
     * @expectedException \Exception
1111
     */
1112
    public function testGetVazby()
1113
    {
1114
        switch ($this->object->getEvidence()) {
1115
            case '':
1116
            case 'c':
1117
            case 'hooks':
1118
            case 'status':
1119
            case 'changes':
1120
            case 'nastaveni':
1121
            case 'evidence-list':
1122
                break;
1123
            default:
1124
                $this->object->getVazby($this->object->getMyKey());
1125
                break;
1126
        }
1127
        $this->object->getVazby();
1128
    }
1129
1130
    /**
1131
     * @covers FlexiPeeHP\FlexiBeeRO::evidenceUrlWithSuffix
1132
     */
1133
    public function testEvidenceUrlWithSuffix()
1134
    {
1135
        $urlraw = $this->object->getEvidenceURL();
1136
        $lala   = $this->object->evidenceUrlWithSuffix('lala');
1137
        $this->assertEquals($urlraw.'/lala', $lala);
1138
        $lolo   = $this->object->evidenceUrlWithSuffix('?lele');
1139
        $this->assertEquals($urlraw.'?lele', $lolo);
1140
        $lulu   = $this->object->evidenceUrlWithSuffix(';lulu');
1141
        $this->assertEquals($urlraw.';lulu', $lulu);
1142
    }
1143
1144
    /**
1145
     * @covers FlexiPeeHP\FlexiBeeRO::join
1146
     * @expectedException \Ease\Exception
1147
     */
1148
    public function testJoin()
1149
    {
1150
        $ada = new FlexiBeeRO(['id' => 'A'], ['evidence' => 'adresar']);
1151
        $adb = new FlexiBeeRO(['id' => 'B'], ['evidence' => 'adresar']);
1152
        $this->assertTrue($this->object->join($ada));
1153
        $this->assertTrue($this->object->join($adb));
1154
        $ads = new \stdClass();
1155
        $this->object->join($ads);
0 ignored issues
show
Bug introduced by
$ads of type stdClass is incompatible with the type FlexiPeeHP\FlexiBeeRO expected by parameter $object of FlexiPeeHP\FlexiBeeRO::join(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1155
        $this->object->join(/** @scrutinizer ignore-type */ $ads);
Loading history...
1156
    }
1157
1158
    /**
1159
     * @covers FlexiPeeHP\FlexiBeeRO::addDefaultUrlParams
1160
     */
1161
    public function testAddDefaultUrlParams()
1162
    {
1163
        $this->object->defaultUrlParams       = [];
1164
        $this->assertEquals('http://vitexsoftware.cz?a=b',
1165
            $this->object->addDefaultUrlParams('http://vitexsoftware.cz?a=b'));
1166
        $this->object->defaultUrlParams['id'] = 1;
1167
        $this->assertEquals('http://vitexsoftware.cz/path?id=1&a=b',
1168
            $this->object->addDefaultUrlParams('http://vitexsoftware.cz/path?a=b'));
1169
    }
1170
1171
    public function testFlexiDateToDateTime()
1172
    {
1173
        $this->assertEquals(1495749600,
1174
            FlexiBeeRO::flexiDateToDateTime('2017-05-26+02:00')->getTimestamp());
1175
    }
1176
1177
    public function testFlexiDateTimeToDateTime()
1178
    {
1179
        $this->assertEquals(1506412853,
1180
            FlexiBeeRO::flexiDateTimeToDateTime('2017-09-26T10:00:53.755+02:00')->getTimestamp());
1181
    }
1182
1183
    /**
1184
     * @covers FlexiPeeHP\FlexiBeeRO::setDataValue
1185
     */
1186
    public function testSetDataValue()
1187
    {
1188
        if (!empty($this->object->getColumnsInfo())) {
1189
            $this->object->setDataValue('datVyst', new \DateTime());
1190
        }
1191
        $this->object->setDataValue('test', 'test');
1192
        $this->object->setDataValue('kod', 'code:testKOD');
1193
        $this->assertEquals('testKOD', $this->object->getDataValue('kod'));
1194
    }
1195
1196
    /**
1197
     * @covers FlexiPeeHP\FlexiBeeRO::saveDebugFiles
1198
     */
1199
    public function testSaveDebugFiles()
1200
    {
1201
        $this->object->saveDebugFiles();
1202
    }
1203
1204
    /**
1205
     * @covers FlexiPeeHP\FlexiBeeRO::setPostFields
1206
     * @covers FlexiPeeHP\FlexiBeeRO::getPostFields
1207
     */
1208
    public function testSetPostFields()
1209
    {
1210
        $this->object->setPostFields('test');
1211
        $this->assertEquals($this->object->getPostFields(), 'test');
1212
    }
1213
1214
    /**
1215
     * PHP Date object to FlexiBee date format test
1216
     * 
1217
     * @covers FlexiPeeHP\FlexiBeeRO::dateToFlexiDate
1218
     */
1219
    public function testDateToFlexiDate()
1220
    {
1221
        $dater = new \DateTime();
1222
        $this->assertEquals($dater->format(FlexiBeeRO::$DateFormat),
1223
            FlexiBeeRO::dateToFlexiDate($dater));
1224
    }
1225
1226
    /**
1227
     * PHP Date object to FlexiBee dateTime format test
1228
     * 
1229
     * @covers FlexiPeeHP\FlexiBeeRO::dateToFlexiDateTime
1230
     */
1231
    public function testDateToFlexiDateTime()
1232
    {
1233
        $dater = new \DateTime();
1234
        $this->assertEquals($dater->format(FlexiBeeRO::$DateTimeFormat),
1235
            FlexiBeeRO::dateToFlexiDateTime($dater));
1236
    }
1237
1238
    public function testSetFilter()
1239
    {
1240
        $this->object->setFilter('X');
1241
        $this->object->setFilter(['a' => 'b']);
1242
    }
1243
1244
    /**
1245
     * @covers FlexiPeeHP\FlexiBeeRO::getColumnInfo
1246
     */
1247
    public function testGetColumnInfo()
1248
    {
1249
        $this->object->getColumnInfo('id');
1250
    }
1251
1252
    /**
1253
     * @covers FlexiPeeHP\FlexiBeeRO::getFlexiBeeURL
1254
     */
1255
    public function testGetFlexiBeeURL()
1256
    {
1257
        $this->object->getFlexiBeeURL();
1258
    }
1259
1260
    /**
1261
     * @covers FlexiPeeHP\FlexiBeeRO::error500Reporter
1262
     */
1263
    public function testError500Reporter()
1264
    {
1265
        $this->object->reportRecipient = '[email protected]';
1266
        $this->object->error500Reporter(['success' => 'false', 'message' => 'test']);
1267
    }
1268
1269
    /**
1270
     * @covers FlexiPeeHP\FlexiBeeRO::setMyKey
1271
     */
1272
    public function testSetMyKey()
1273
    {
1274
        $this->object->setMyKey(1);
1275
    }
1276
1277
    /**
1278
     * @covers FlexiPeeHP\FlexiBeeRO::ignore404
1279
     */
1280
    public function testIgnore404()
1281
    {
1282
        $this->object->ignore404(true);
1283
        $this->assertTrue($this->object->ignore404());
1284
    }
1285
1286
    /**
1287
     * @covers FlexiPeeHP\FlexiBeeRO::sendByMail
1288
     */
1289
    public function testSendByMail()
1290
    {
1291
        $this->object->sendByMail($this->object->reportRecipient, 'test',
1292
            'test body');
1293
    }
1294
1295
    /**
1296
     * @covers FlexiPeeHP\FlexiBeeRO::sendUnsent
1297
     */
1298
    public function testSendUnsent()
1299
    {
1300
        $this->object->sendUnsent();
1301
    }
1302
1303
    /**
1304
     * @covers FlexiPeeHP\FlexiBeeRO::getInFormat
1305
     */
1306
    public function testGetInFormat()
1307
    {
1308
        $this->object->evidence = 'test';
1309
        $this->object->getInFormat('html', 'test');
1310
    }
1311
1312
    /**
1313
     * @covers FlexiPeeHP\FlexiBeeRO::downloadInFormat
1314
     */
1315
    public function testDownloadInFormat()
1316
    {
1317
        $this->object->downloadInFormat('pdf', sys_get_temp_dir().'/');
1318
    }
1319
1320
    /**
1321
     * @covers FlexiPeeHP\FlexiBeeRO::code
1322
     */
1323
    public function testCode()
1324
    {
1325
        $this->assertEquals('code:TEST', FlexiBeeRO::code('test'));
1326
    }
1327
1328
    /**
1329
     * @covers FlexiPeeHP\FlexiBeeRO::uncode
1330
     */
1331
    public function testUncode()
1332
    {
1333
        $this->assertEquals('test', FlexiBeeRO::uncode('code:test'));
1334
    }
1335
1336
    /**
1337
     * @covers FlexiPeeHP\FlexiBeeRO::arrayCleanUP
1338
     */
1339
    public function testArrayCleanUP()
1340
    {
1341
        $this->assertEquals(['a' => 'b'],
1342
            FlexiBeeRO::arrayCleanUP(['a' => 'b', '@a' => 'aaa']));
1343
    }
1344
1345
    /**
1346
     * @covers FlexiPeeHP\FlexiBeeRO::__wakeup
1347
     */
1348
    public function test__wakeup()
1349
    {
1350
        $this->object->__wakeup();
1351
    }
1352
1353
    /**
1354
     * @covers FlexiPeeHP\FlexiBeeRO::__destruct
1355
     */
1356
    public function test_destruct()
1357
    {
1358
        $this->object->__destruct();
1359
    }
1360
}
1361