ChangesTest   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 12
eloc 24
dl 0
loc 104
c 0
b 0
f 0
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A testEnable() 0 3 1
A setUp() 0 3 1
A testRecordExists() 0 3 1
A testIdExists() 0 3 1
A testDisable() 0 4 1
A tearDown() 0 2 1
A testPerformRequest() 0 3 1
A testGetStatus() 0 4 1
A testGetFlexiData() 0 23 4
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(): void
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
    }
33
34
    /**
35
     * @covers FlexiPeeHP\Changes::performRequest
36
     * @depends testEnable
37
     */
38
    public function testPerformRequest()
39
    {
40
        parent::testPerformRequest();
41
    }
42
43
    /**
44
     * @covers FlexiPeeHP\Changes::idExists
45
     * @depends testEnable
46
     */
47
    public function testIdExists()
48
    {
49
        $this->object->idExists();
50
    }
51
52
    /**
53
     * @covers FlexiPeeHP\Changes::getFlexiData
54
     * @depends testEnable
55
     */
56
    public function testGetFlexiData()
57
    {
58
        /**
59
         * Make Some Changes First ...
60
         */
61
        $address = new \FlexiPeeHP\Adresar();
62
        $address->setDataValue('nazev', \Ease\Sand::randomString());
63
        $address->setDataValue('poznam', 'Unit Test Random Record');
64
        $address->insertToFlexiBee();
65
66
        $flexidata = $this->object->getFlexiData();
67
68
        if (isset($flexidata['message']) && ($flexidata['message'] == 'Changelog is not enabled')) {
69
            $this->markTestSkipped('Changelog is not enabled');
0 ignored issues
show
Bug introduced by
The method markTestSkipped() does not exist on Test\FlexiPeeHP\ChangesTest. Did you maybe mean markTestSuiteSkipped()? ( Ignorable by Annotation )

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

69
            $this->/** @scrutinizer ignore-call */ 
70
                   markTestSkipped('Changelog is not enabled');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
70
        } else {
71
            if (count($flexidata)) {
72
                $this->assertArrayHasKey(0, $flexidata);
0 ignored issues
show
Bug introduced by
The method assertArrayHasKey() does not exist on Test\FlexiPeeHP\ChangesTest. ( Ignorable by Annotation )

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

72
                $this->/** @scrutinizer ignore-call */ 
73
                       assertArrayHasKey(0, $flexidata);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
73
            } else {
74
                $this->markTestSkipped('Changelog is empty ?');
75
            }
76
        }
77
78
        $address->deleteFromFlexiBee();
79
    }
80
81
    /**
82
     * @covers FlexiPeeHP\Changes::recordExists
83
     */
84
    public function testRecordExists()
85
    {
86
        $this->assertNull($this->object->recordExists());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->object->recordExists() targeting FlexiPeeHP\Changes::recordExists() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Bug introduced by
The method assertNull() does not exist on Test\FlexiPeeHP\ChangesTest. ( Ignorable by Annotation )

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

86
        $this->/** @scrutinizer ignore-call */ 
87
               assertNull($this->object->recordExists());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
87
    }
88
89
    /**
90
     * @covers FlexiPeeHP\Changes::disable
91
     */
92
    public function testDisable()
93
    {
94
        $this->object->disable();
95
        $this->assertFalse($this->object->getStatus());
0 ignored issues
show
Bug introduced by
The method assertFalse() does not exist on Test\FlexiPeeHP\ChangesTest. ( Ignorable by Annotation )

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

95
        $this->/** @scrutinizer ignore-call */ 
96
               assertFalse($this->object->getStatus());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
96
    }
97
98
    /**
99
     * @covers FlexiPeeHP\Changes::getStatus
100
     */
101
    public function testGetStatus()
102
    {
103
        $status = $this->object->getStatus();
104
        $this->assertInternalType('boolean', $status);
0 ignored issues
show
Bug introduced by
The method assertInternalType() does not exist on Test\FlexiPeeHP\ChangesTest. ( Ignorable by Annotation )

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

104
        $this->/** @scrutinizer ignore-call */ 
105
               assertInternalType('boolean', $status);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
105
    }
106
107
    
108
    /**
109
     * Tears down the fixture, for example, closes a network connection.
110
     * This method is called after a test is executed.
111
     */
112
    protected function tearDown(): void
113
    {
114
        
115
    }
116
}
117