Completed
Push — master ( 14dc45...6a7b8b )
by Vítězslav
08:50
created

ChangesTest   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 10
c 3
b 0
f 1
lcom 1
cbo 4
dl 0
loc 90
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testEnable() 0 5 1
B testGetFlexiData() 0 25 4
A testRecordExists() 0 4 1
A testDisable() 0 5 1
A testGetStatus() 0 5 1
A tearDown() 0 4 1
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();
0 ignored issues
show
Bug introduced by
The call to deleteFromFlexiBee() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
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