Passed
Push — master ( b34030...56c38f )
by Sebastian
03:50
created

ActionTest::testGetAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of CaptainHook.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace sebastianfeldmann\CaptainHook\Config;
11
12
class ActionTest extends \PHPUnit_Framework_TestCase
13
{
14
    /**
15
     * Tests Action::getType
16
     */
17
    public function testGetType()
18
    {
19
        $action = new Action('php', '\\Foo\\Bar');
20
21
        $this->assertEquals('php', $action->getType());
22
    }
23
24
    /**
25
     * Tests Action::getAction
26
     */
27
    public function testGetAction()
28
    {
29
        $action = new Action('php', '\\Foo\\Bar');
30
        $this->assertEquals('\\Foo\\Bar', $action->getAction());
31
    }
32
33
    /**
34
     * Tests Action::getOption
35
     */
36
    public function testGetOptions()
37
    {
38
        $action = new Action('php', '\\Foo\\Bar');
39
        $this->assertEquals([], $action->getOptions());
40
    }
41
42
    /**
43
     * Tests Action::__construct
44
     */
45
    public function testEmptyOptions()
46
    {
47
        $action = new Action('php', '\\Foo\\Bar');
48
        $config = $action->getJsonData();
49
50
        $this->assertEquals(0, count($config['options']));
51
    }
52
53
    /**
54
     * Tests Action::__construct
55
     *
56
     * @expectedException \Exception
57
     */
58
    public function testInvalidType()
59
    {
60
        $action = new Action('crap', 'with cinnamon and sugar');
0 ignored issues
show
Unused Code introduced by
$action 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...
61
    }
62
}
63