CompanyTest   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 109
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 11
eloc 25
dl 0
loc 109
c 0
b 0
f 0
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 2 1
A testDraw() 0 4 1
A testGetMyKey() 0 3 1
A testGetRecordID() 0 4 1
A testGetResponseEvidence() 0 3 1
A testObjectToID() 0 3 1
A setUp() 0 3 1
A testtoString() 0 5 1
A testGetFlexiData() 0 5 1
A testPerformRequest() 0 9 1
A testProcessInit() 0 5 1
1
<?php
2
/**
3
 * FlexiPeeHP - Objekt firmy.
4
 *
5
 * @author     Vítězslav Dvořák <[email protected]>
6
 * @copyright  (C) 2015-2017 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(): void
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(): void
37
    {
38
        
39
    }
40
41
    /**
42
     * @covers Ease\Brick::getMyKey
43
     */
44
    public function testGetMyKey()
45
    {
46
        $this->assertEquals('X', $this->object->getmyKey(['dbNazev' => 'X']));
0 ignored issues
show
Bug introduced by
The method assertEquals() does not exist on Test\FlexiPeeHP\CompanyTest. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
        $this->/** @scrutinizer ignore-call */ 
47
               assertEquals('X', $this->object->getmyKey(['dbNazev' => 'X']));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
    }
48
49
    /**
50
     * @covers FlexiPeeHP\Company::processInit
51
     */
52
    public function testProcessInit()
53
    {
54
        $this->object->processInit(['dbNazev' => constant('FLEXIBEE_COMPANY')]);
55
        $this->assertEquals(constant('FLEXIBEE_COMPANY'), $this->object->company);
56
        $this->assertEquals(200, $this->object->lastResponseCode);
57
    }
58
59
    /**
60
     * @covers FlexiPeeHP\Company::getRecordID
61
     */
62
    public function testGetRecordID()
63
    {
64
        $this->object->setData(['dbNazev' => 'TEST']);
65
        $this->assertEquals('TEST', $this->object->getRecordID());
66
    }
67
68
    /**
69
     * @covers FlexiPeeHP\Company::objectToID
70
     */
71
    public function testObjectToID()
72
    {
73
        $this->assertEquals('TEST', $this->object->objectToID('TEST'));
0 ignored issues
show
Bug introduced by
'TEST' of type string is incompatible with the type array|object expected by parameter $object of FlexiPeeHP\FlexiBeeRO::objectToID(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

73
        $this->assertEquals('TEST', $this->object->objectToID(/** @scrutinizer ignore-type */ 'TEST'));
Loading history...
74
    }
75
76
    /**
77
     * @covers FlexiPeeHP\Company::performRequest
78
     */
79
    public function testPerformRequest()
80
    {
81
        $json                    = $this->object->performRequest();
82
        $this->assertArrayHasKey('company', $json);
0 ignored issues
show
Bug introduced by
The method assertArrayHasKey() does not exist on Test\FlexiPeeHP\CompanyTest. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

82
        $this->/** @scrutinizer ignore-call */ 
83
               assertArrayHasKey('company', $json);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
83
84
        $xml = $this->object->performRequest(null, 'GET', 'xml');
85
        $this->assertArrayHasKey('company', $xml);
86
        $nonExist = $this->object->performRequest('error.json');
87
        $this->assertEquals($nonExist['success'],'false');
88
    }
89
90
    /**
91
     * @covers FlexiPeeHP\Company::getFlexiData
92
     */
93
    public function testGetFlexiData()
94
    {
95
        $flexidata = $this->object->getFlexiData();
96
        $this->assertArrayHasKey(0, $flexidata);
97
        $this->assertArrayHasKey('id', $flexidata[0]);
98
    }
99
100
    /**
101
     * @covers FlexiPeeHP\Company::getResponseEvidence
102
     */
103
    public function testGetResponseEvidence()
104
    {
105
        $this->assertEquals('company', $this->object->getResponseEvidence());
106
    }
107
108
    /**
109
     * @covers FlexiPeeHP\Company::__toString
110
     */
111
    public function testtoString()
112
    {
113
        $company = 'test';
114
        $this->object->setDataValue('dbNazev', $company);
115
        $this->assertEquals($company, (string) $this->object);
116
    }
117
118
    /**
119
     * @covers FlexiPeeHP\Company::draw
120
     */
121
    public function testDraw($whatWant = NULL)
122
    {
123
        $this->object->setDataValue('dbNazev', 'test');
124
        $this->assertEquals('test', $this->object->draw());
125
    }
126
}
127