1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Test\FlexiPeeHP; |
4
|
|
|
|
5
|
|
|
use FlexiPeeHP\Changes; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-05-24 at 14:37:24. |
9
|
|
|
*/ |
10
|
|
|
class ChangesTest extends FlexiBeeROTest |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var Changes |
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
|
|
|
*/ |
21
|
|
|
protected function setUp() |
22
|
|
|
{ |
23
|
|
|
$this->object = new Changes(); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @covers FlexiPeeHP\Changes::enable |
28
|
|
|
*/ |
29
|
|
|
public function testEnable() |
30
|
|
|
{ |
31
|
|
|
$this->object->enable(); |
32
|
|
|
$this->assertTrue($this->object->getStatus()); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @covers FlexiPeeHP\Changes::getFlexiData |
37
|
|
|
*/ |
38
|
|
|
public function testGetFlexiData() |
39
|
|
|
{ |
40
|
|
|
/** |
41
|
|
|
* Make Some Changes First ... |
42
|
|
|
*/ |
43
|
|
|
$address = new \FlexiPeeHP\Adresar(); |
44
|
|
|
$address->setDataValue('nazev', \Ease\Sand::randomString()); |
45
|
|
|
$address->setDataValue('poznam', 'Unit Test Random Record'); |
46
|
|
|
$address->insertToFlexiBee(); |
47
|
|
|
|
48
|
|
|
$flexidata = $this->object->getFlexiData(); |
49
|
|
|
|
50
|
|
|
if (isset($flexidata['message']) && ($flexidata['message'] == 'Changelog is not enabled')) { |
51
|
|
|
$this->markTestSkipped('Changelog is not enabled'); |
52
|
|
|
} else { |
53
|
|
|
if (count($flexidata)) { |
54
|
|
|
$this->assertArrayHasKey(0, $flexidata); |
55
|
|
|
$this->assertArrayHasKey('id', $flexidata[0]); |
56
|
|
|
} else { |
57
|
|
|
$this->markTestSkipped('Changelog is empty ?'); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
$address->deleteFromFlexiBee(); |
|
|
|
|
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @covers FlexiPeeHP\Changes::recordExists |
66
|
|
|
*/ |
67
|
|
|
public function testRecordExists() |
68
|
|
|
{ |
69
|
|
|
$this->assertNull($this->object->recordExists()); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @covers FlexiPeeHP\Changes::disable |
74
|
|
|
*/ |
75
|
|
|
public function testDisable() |
76
|
|
|
{ |
77
|
|
|
$this->object->disable(); |
78
|
|
|
$this->assertFalse($this->object->getStatus()); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @covers FlexiPeeHP\Changes::getStatus |
83
|
|
|
*/ |
84
|
|
|
public function testGetStatus() |
85
|
|
|
{ |
86
|
|
|
$status = $this->object->getStatus(); |
87
|
|
|
$this->assertInternalType('boolean', $status); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Tears down the fixture, for example, closes a network connection. |
92
|
|
|
* This method is called after a test is executed. |
93
|
|
|
*/ |
94
|
|
|
protected function tearDown() |
95
|
|
|
{ |
96
|
|
|
|
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
} |
100
|
|
|
|
This check looks for function calls that miss required arguments.