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() |
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 Ease\Brick::getMyKey |
43
|
|
|
* |
44
|
|
|
* @todo Implement testGetMyKey(). |
45
|
|
|
*/ |
46
|
|
|
public function testGetMyKey() |
47
|
|
|
{ |
48
|
|
|
$this->assertEquals('X', $this->object->getmyKey(['dbNazev' => 'X'])); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @covers FlexiPeeHP\Company::processInit |
53
|
|
|
*/ |
54
|
|
|
public function testProcessInit() |
55
|
|
|
{ |
56
|
|
|
$this->object->processInit(['dbNazev' => constant('FLEXIBEE_COMPANY')]); |
57
|
|
|
$this->assertEquals(constant('FLEXIBEE_COMPANY'), $this->object->company); |
58
|
|
|
$this->assertEquals(200, $this->object->lastResponseCode); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @covers FlexiPeeHP\Company::getRecordID |
63
|
|
|
*/ |
64
|
|
|
public function testGetRecordID() |
65
|
|
|
{ |
66
|
|
|
$this->object->setData(['dbNazev' => 'TEST']); |
67
|
|
|
$this->assertEquals('TEST', $this->object->getRecordID()); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @covers FlexiPeeHP\Company::objectToID |
72
|
|
|
*/ |
73
|
|
|
public function testObjectToID() |
74
|
|
|
{ |
75
|
|
|
$this->assertEquals('TEST', $this->object->objectToID('TEST')); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @covers FlexiPeeHP\Company::performRequest |
80
|
|
|
*/ |
81
|
|
|
public function testPerformRequest() |
82
|
|
|
{ |
83
|
|
|
$this->object->evidence = 'c'; |
84
|
|
|
$this->object->prefix = ''; |
85
|
|
|
$this->object->company = ''; |
86
|
|
|
$this->object->nameSpace = 'companies'; |
87
|
|
|
$json = $this->object->performRequest(); |
88
|
|
|
$this->assertArrayHasKey('company', $json); |
89
|
|
|
|
90
|
|
|
$xml = $this->object->performRequest(null, 'GET', 'xml'); |
91
|
|
|
$this->assertArrayHasKey('company', $xml); |
92
|
|
|
|
93
|
|
|
$this->assertNull($this->object->performRequest('error.json')); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @covers FlexiPeeHP\Company::getFlexiData |
98
|
|
|
*/ |
99
|
|
|
public function testGetFlexiData() |
100
|
|
|
{ |
101
|
|
|
$flexidata = $this->object->getFlexiData(); |
102
|
|
|
$this->assertArrayHasKey(0, $flexidata); |
103
|
|
|
$this->assertArrayHasKey('id', $flexidata[0]); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @covers FlexiPeeHP\Company::getResponseEvidence |
108
|
|
|
*/ |
109
|
|
|
public function testGetResponseEvidence() |
110
|
|
|
{ |
111
|
|
|
$this->assertEquals('company', $this->object->getResponseEvidence()); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @covers FlexiPeeHP\Company::__toString |
116
|
|
|
*/ |
117
|
|
|
public function testtoString() |
118
|
|
|
{ |
119
|
|
|
$company = 'test'; |
120
|
|
|
$this->object->setDataValue('dbNazev', $company); |
121
|
|
|
$this->assertEquals($company, (string) $this->object); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @covers FlexiPeeHP\Company::draw |
126
|
|
|
*/ |
127
|
|
|
public function testDraw($whatWant = NULL) |
128
|
|
|
{ |
129
|
|
|
$this->object->setDataValue('dbNazev', 'test'); |
130
|
|
|
$this->assertEquals('test', $this->object->draw()); |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: