Completed
Push — master ( 596467...bf19e6 )
by Vítězslav
11:06
created

CompanyTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 5
c 3
b 0
f 1
lcom 1
cbo 2
dl 0
loc 64
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A tearDown() 0 4 1
A testPerformRequest() 0 16 1
A testGetFlexiData() 0 6 1
A testGetResponseEvidence() 0 4 1
1
<?php
2
/**
3
 * FlexiPeeHP - Objekt firmy.
4
 *
5
 * @author     Vítězslav Dvořák <[email protected]>
6
 * @copyright  (C) 2015,2016 Spoje.Net
7
 */
8
9
namespace Test\FlexiPeeHP;
10
11
use FlexiPeeHP\Company;
12
13
/**
14
 * Generated by PHPUnit_SkeletonGenerator on 2016-04-27 at 17:54:36.
15
 */
16
class CompanyTest extends FlexiBeeROTest
17
{
18
    /**
19
     * @var Company
20
     */
21
    protected $object;
22
23
    /**
24
     * Sets up the fixture, for example, opens a network connection.
25
     * This method is called before a test is executed.
26
     */
27
    protected function setUp()
28
    {
29
        $this->object = new Company;
30
    }
31
32
    /**
33
     * Tears down the fixture, for example, closes a network connection.
34
     * This method is called after a test is executed.
35
     */
36
    protected function tearDown()
37
    {
38
39
    }
40
41
    /**
42
     * @covers FlexiPeeHP\Company::performRequest
43
     */
44
    public function testPerformRequest()
45
    {
46
        $this->object->evidence  = 'c';
47
        $this->object->prefix    = '';
48
        $this->object->company   = '';
49
        $this->object->nameSpace = 'companies';
50
        $json                    = $this->object->performRequest();
51
        $this->assertArrayHasKey('company', $json);
52
53
        $xml = $this->object->performRequest(null, 'GET', 'xml');
54
        $this->assertArrayHasKey('company', $xml);
55
56
        $err = $this->object->performRequest('error.json');
57
        $this->assertArrayHasKey('success', $err);
58
        $this->assertEquals('false', $err['success']);
59
    }
60
61
    /**
62
     * @covers FlexiPeeHP\Company::getFlexiData
63
     */
64
    public function testGetFlexiData()
65
    {
66
        $flexidata = $this->object->getFlexiData();
67
        $this->assertArrayHasKey(0, $flexidata['company']);
68
        $this->assertArrayHasKey('id', $flexidata['company'][0]);
69
    }
70
71
    /**
72
     * @covers FlexiPeeHP\Compny::getResponseEvidence
73
     */
74
    public function testGetResponseEvidence()
75
    {
76
        $this->assertEquals('companies', $this->object->getResponseEvidence());
77
    }
78
79
}
80