Passed
Push — master ( 813fe9...62056b )
by Sebastian
06:01
created

HookTest::testAddAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 9
loc 9
rs 9.6666
cc 1
eloc 6
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 CaptainHook\App\Config;
11
12
class HookTest extends \PHPUnit_Framework_TestCase
13
{
14
    /**
15
     * Tests Hook::__construct
16
     */
17 View Code Duplication
    public function testDisabledByDefault()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
    {
19
        $hook   = new Hook();
20
        $config = $hook->getJsonData();
21
22
        $this->assertEquals(false, $hook->isEnabled());
23
        $this->assertEquals(false, $config['enabled']);
24
    }
25
26
    /**
27
     * Tests Hook::setEnabled
28
     */
29 View Code Duplication
    public function testSetEnabled()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31
        $hook   = new Hook();
32
        $hook->setEnabled(true);
33
        $config = $hook->getJsonData();
34
35
        $this->assertEquals(true, $hook->isEnabled());
36
        $this->assertEquals(true, $config['enabled']);
37
    }
38
39
    /**
40
     * Tests Hook::__construct
41
     */
42 View Code Duplication
    public function testEmptyActions()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44
        $hook   = new Hook();
45
        $config = $hook->getJsonData();
46
47
        $this->assertEquals(0, count($hook->getActions()));
48
        $this->assertEquals(0, count($config['actions']));
49
    }
50
51
    /**
52
     * Tests Hook::addAction
53
     */
54 View Code Duplication
    public function testAddAction()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
    {
56
        $hook   = new Hook();
57
        $hook->addAction(new Action('php', '\\Foo\\Bar'));
58
        $config = $hook->getJsonData();
59
60
        $this->assertEquals(1, count($hook->getActions()));
61
        $this->assertEquals(1, count($config['actions']));
62
    }
63
}
64