Completed
Push — master ( 41ec40...fd6b09 )
by Vítězslav
03:26
created

StatusTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Test\FlexiPeeHP;
4
5
use \FlexiPeeHP\Status;
6
7
/**
8
 * Generated by PHPUnit_SkeletonGenerator on 2016-10-27 at 23:57:50.
9
 */
10
class StatusTest extends FlexiBeeROTest
11
{
12
    /**
13
     * @var Status
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 \FlexiPeeHP\Status();
24
    }
25
26
    /**
27
     * Tears down the fixture, for example, closes a network connection.
28
     * This method is called after a test is executed.
29
     */
30
    protected function tearDown()
31
    {
32
33
    }
34
35
    public function testConstructor()
36
    {
37
        $classname = get_class($this->object);
38
        $evidence  = $this->object->getEvidence();
0 ignored issues
show
Unused Code introduced by
$evidence is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
39
40
        // Get mock, without the constructor being called
41
        $mock = $this->getMockBuilder($classname)
42
            ->disableOriginalConstructor()
43
            ->getMockForAbstractClass();
44
        $mock->__construct();
45
    }
46
47
    /**
48
     * @covers FlexiPeeHP\Status::getFlexiData
49
     */
50
    public function testGetFlexiData()
51
    {
52
        $this->assertArrayKeyExists('version', $this->object->getFlexiData());
0 ignored issues
show
Bug introduced by
The method assertArrayKeyExists() does not seem to exist on object<Test\FlexiPeeHP\StatusTest>.

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...
53
    }
54
55
    /**
56
     * @covers FlexiPeeHP\Status::unifyResponseFormat
57
     */
58
    public function testUnifyResponseFormat()
59
    {
60
        $this->assertEquals(['success' => 'false'],
61
            $this->object->unifyResponseFormat(['success' => 'false']));
62
        $this->assertEquals(['version' => 'ok'],
63
            $this->object->unifyResponseFormat(['status' => ['version' => 'ok']]));
64
    }
65
}
66