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

HooksTest::testGetFlexiData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Test\FlexiPeeHP;
4
5
use FlexiPeeHP\Hooks;
6
use FlexiPeeHP\Changes;
7
8
/**
9
 * Generated by PHPUnit_SkeletonGenerator on 2016-05-24 at 14:37:54.
10
 */
11
class HooksTest extends FlexiBeeRWTest
12
{
13
    /**
14
     * @var Hooks
15
     */
16
    protected $object;
17
18
    /**
19
     * Changes API enabler/disabler
20
     * @var Changes
21
     */
22
    protected $changes;
23
24
    /**
25
     * Sets up the fixture, for example, opens a network connection.
26
     * This method is called before a test is executed.
27
     */
28
    protected function setUp()
29
    {
30
        $this->object = new Hooks;
31
    }
32
33
    /**
34
     * @covers FlexiPeeHP\Hooks::register
35
     */
36
    public function testRegister()
37
    {
38
        $this->changes = new Changes();
39
        $this->changes->enable();
40
        $this->object->setDataValue('skipUrlTest', 'true');
41
        $result        = $this->object->register('http://localhost/webhook.php');
42
        $this->assertTrue($result);
43
        $result2       = $this->object->register('http://localhost/webhook.php');
44
        $this->assertFalse($result2);
45
    }
46
47
    /**
48
     * @covers FlexiPeeHP\Hooks::getFlexiData
49
     * @depends testRegister
50
     */
51
    public function testGetFlexiData()
52
    {
53
        $flexidata = $this->object->getFlexiData();
54
        $this->assertArrayHasKey(0, $flexidata);
55
        $this->assertArrayHasKey('id', $flexidata[0]);
56
    }
57
58
    /**
59
     * @covers FlexiPeeHP\Hooks::recordExists
60
     * @depends testRegister
61
     */
62
    public function testRecordExists()
63
    {
64
        $this->assertNull($this->object->recordExists());
65
    }
66
67
    /**
68
     * @covers FlexiPeeHP\Hooks::unregister
69
     * @depends testRegister
70
     */
71
    public function testUnregister()
72
    {
73
        $hooks = $this->object->getAllFromFlexibee();
74
        $this->assertTrue($this->object->unregister(current(end($hooks))));
75
    }
76
77
    /**
78
     * Disable ChangesAPI
79
     */
80
    protected function tearDown()
81
    {
82
        
83
    }
84
85
}
86