Completed
Push — master ( 7483cb...a139b5 )
by Vítězslav
03:58
created

CompanyTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 55
rs 10
wmc 4
lcom 1
cbo 2

4 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
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 FlexiBeeTest
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, null, '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
}