Completed
Push — master ( 20c412...48d54d )
by Vítězslav
05:37
created

HooksTest::testGetFlexiData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 9.4285
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 FlexiBeeTest
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
        $this->changes = new Changes();
32
        $this->changes->enable();
33
    }
34
35
    /**
36
     * @covers FlexiPeeHP\Hooks::register
37
     */
38
    public function testRegister()
39
    {
40
        $this->object->setDataValue('skipUrlTest', 'true');
41
        $result = $this->object->register('http://lms.vyvojar.spoje.net/webhook.php');
42
        $this->assertEmpty($result);
43
    }
44
45
    /**
46
     * @covers FlexiPeeHP\FlexiBee::getFlexiData
47
     */
48
    public function testGetFlexiData()
49
    {
50
        $flexidata = $this->object->getFlexiData();
51
        $this->assertArrayHasKey(0, $flexidata);
52
        $this->assertArrayHasKey('id', $flexidata[0]);
53
        /* Zde nefunguje vyhledávání ? 
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
54
          $filtrered = $this->object->getFlexiData(null,
55
          key($flexidata[0])." = ".current($flexidata[0]));
56
          $this->assertArrayHasKey(0, $filtrered);
57
          $this->assertArrayHasKey('id', $filtrered[0]);
58
         */
59
    }
60
61
    /**
62
     * @covers FlexiPeeHP\Hooks::unregister
63
     */
64
    public function testUnregister()
65
    {
66
        $hooks = $this->object->getAllFromFlexibee();
67
        $this->assertTrue($this->object->unregister(current(end($hooks))));
68
    }
69
70
    /**
71
     * Disable ChangesAPI
72
     */
73
    protected function tearDown()
74
    {
75
        $this->changes->disable();
76
    }
77
}