|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Test\FlexiPeeHP; |
|
4
|
|
|
|
|
5
|
|
|
use FlexiPeeHP\FlexiBee; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-05-04 at 10:08:36. |
|
9
|
|
|
*/ |
|
10
|
|
|
class FlexiBeeTest extends \Test\Ease\BrickTest |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* @var FlexiBee |
|
14
|
|
|
*/ |
|
15
|
|
|
protected $object; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Sets up the fixture, for example, opens a network connection. |
|
19
|
|
|
* This method is called before a test is executed. |
|
20
|
|
|
* @covers FlexiPeeHP\FlexiBee::__construct |
|
21
|
|
|
*/ |
|
22
|
|
|
protected function setUp() |
|
23
|
|
|
{ |
|
24
|
|
|
$this->object = new FlexiBee; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Tears down the fixture, for example, closes a network connection. |
|
29
|
|
|
* This method is called after a test is executed. |
|
30
|
|
|
*/ |
|
31
|
|
|
protected function tearDown() |
|
32
|
|
|
{ |
|
33
|
|
|
|
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function testConstructor() |
|
37
|
|
|
{ |
|
38
|
|
|
$classname = get_class($this->object); |
|
39
|
|
|
|
|
40
|
|
|
// Get mock, without the constructor being called |
|
41
|
|
|
$mock = $this->getMockBuilder($classname) |
|
42
|
|
|
->disableOriginalConstructor() |
|
43
|
|
|
->setMethods(array('curlInit')) |
|
44
|
|
|
->getMockForAbstractClass(); |
|
45
|
|
|
|
|
46
|
|
|
// set expectations for constructor calls |
|
47
|
|
|
$mock->expects($this->once()) |
|
48
|
|
|
->method('curlInit') |
|
49
|
|
|
->with( |
|
50
|
|
|
$this->equalTo(4) |
|
51
|
|
|
); |
|
52
|
|
|
|
|
53
|
|
|
// now call the constructor |
|
54
|
|
|
$reflectedClass = new \ReflectionClass($classname); |
|
55
|
|
|
$constructor = $reflectedClass->getConstructor(); |
|
56
|
|
|
$constructor->invoke($mock, 4); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function testCurlInit() |
|
60
|
|
|
{ |
|
61
|
|
|
$this->object->curlInit(); |
|
62
|
|
|
$this->assertTrue(is_resource($this->object->curl)); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @covers FlexiPeeHP\FlexiBee::setAgenda |
|
67
|
|
|
*/ |
|
68
|
|
|
public function testSetAgenda() |
|
69
|
|
|
{ |
|
70
|
|
|
$this->object->setAgenda('nastaveni'); |
|
71
|
|
|
$this->assertEquals('nastaveni', $this->object->agenda); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @covers FlexiPeeHP\FlexiBee::object2array |
|
76
|
|
|
*/ |
|
77
|
|
|
public function testObject2array() |
|
78
|
|
|
{ |
|
79
|
|
|
$this->assertEquals('X', $this->object->object2array('X')); |
|
|
|
|
|
|
80
|
|
|
$this->assertEquals([], $this->object->object2array(new \stdClass())); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @covers FlexiPeeHP\FlexiBee::performRequest |
|
85
|
|
|
*/ |
|
86
|
|
|
public function testPerformRequest() |
|
87
|
|
|
{ |
|
88
|
|
|
|
|
89
|
|
|
if (!is_null($this->object->agenda) && $this->object->agenda != 'test') { |
|
90
|
|
|
$json = $this->object->performRequest($this->object->agenda.'.json'); |
|
91
|
|
|
|
|
92
|
|
|
$this->assertArrayHasKey($json, 'success'); |
|
93
|
|
|
} else { |
|
94
|
|
|
$this->markTestSkipped('Agenda not set'); |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @covers FlexiPeeHP\FlexiBee::getLastImportId |
|
100
|
|
|
* @todo Implement testGetLastImportId(). |
|
101
|
|
|
*/ |
|
102
|
|
|
public function testGetLastImportId() |
|
103
|
|
|
{ |
|
104
|
|
|
// Remove the following lines when you implement this test. |
|
105
|
|
|
$this->markTestIncomplete( |
|
106
|
|
|
'This test has not been implemented yet.' |
|
107
|
|
|
); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* @covers FlexiPeeHP\FlexiBee::xml2array |
|
112
|
|
|
* @todo Implement testXml2array(). |
|
113
|
|
|
*/ |
|
114
|
|
|
public function testXml2array() |
|
115
|
|
|
{ |
|
116
|
|
|
// Remove the following lines when you implement this test. |
|
117
|
|
|
$this->markTestIncomplete( |
|
118
|
|
|
'This test has not been implemented yet.' |
|
119
|
|
|
); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @covers FlexiPeeHP\FlexiBee::disconnect |
|
124
|
|
|
* @todo Implement testDisconnect(). |
|
125
|
|
|
*/ |
|
126
|
|
|
public function testDisconnect() |
|
127
|
|
|
{ |
|
128
|
|
|
// Remove the following lines when you implement this test. |
|
129
|
|
|
$this->markTestIncomplete( |
|
130
|
|
|
'This test has not been implemented yet.' |
|
131
|
|
|
); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @covers FlexiPeeHP\FlexiBee::__destruct |
|
136
|
|
|
* @todo Implement test__destruct(). |
|
137
|
|
|
*/ |
|
138
|
|
|
public function test__destruct() |
|
139
|
|
|
{ |
|
140
|
|
|
// Remove the following lines when you implement this test. |
|
141
|
|
|
$this->markTestIncomplete( |
|
142
|
|
|
'This test has not been implemented yet.' |
|
143
|
|
|
); |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* @covers FlexiPeeHP\FlexiBee::loadFlexiData |
|
148
|
|
|
* @todo Implement testLoadFlexiData(). |
|
149
|
|
|
*/ |
|
150
|
|
|
public function testLoadFlexiData() |
|
151
|
|
|
{ |
|
152
|
|
|
// Remove the following lines when you implement this test. |
|
153
|
|
|
$this->markTestIncomplete( |
|
154
|
|
|
'This test has not been implemented yet.' |
|
155
|
|
|
); |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @covers FlexiPeeHP\FlexiBee::getFlexiRow |
|
160
|
|
|
* @todo Implement testGetFlexiRow(). |
|
161
|
|
|
*/ |
|
162
|
|
|
public function testGetFlexiRow() |
|
163
|
|
|
{ |
|
164
|
|
|
// Remove the following lines when you implement this test. |
|
165
|
|
|
$this->markTestIncomplete( |
|
166
|
|
|
'This test has not been implemented yet.' |
|
167
|
|
|
); |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* @covers FlexiPeeHP\FlexiBee::getFlexiData |
|
172
|
|
|
* @todo Implement testGetFlexiData(). |
|
173
|
|
|
*/ |
|
174
|
|
|
public function testGetFlexiData() |
|
175
|
|
|
{ |
|
176
|
|
|
// Remove the following lines when you implement this test. |
|
177
|
|
|
$this->markTestIncomplete( |
|
178
|
|
|
'This test has not been implemented yet.' |
|
179
|
|
|
); |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* @covers FlexiPeeHP\FlexiBee::loadFromFlexiBee |
|
184
|
|
|
* @todo Implement testLoadFromFlexiBee(). |
|
185
|
|
|
*/ |
|
186
|
|
|
public function testLoadFromFlexiBee() |
|
187
|
|
|
{ |
|
188
|
|
|
// Remove the following lines when you implement this test. |
|
189
|
|
|
$this->markTestIncomplete( |
|
190
|
|
|
'This test has not been implemented yet.' |
|
191
|
|
|
); |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @covers FlexiPeeHP\FlexiBee::saveToFlexiBee |
|
196
|
|
|
* @todo Implement testSaveToFlexiBee(). |
|
197
|
|
|
*/ |
|
198
|
|
|
public function testSaveToFlexiBee() |
|
199
|
|
|
{ |
|
200
|
|
|
// Remove the following lines when you implement this test. |
|
201
|
|
|
$this->markTestIncomplete( |
|
202
|
|
|
'This test has not been implemented yet.' |
|
203
|
|
|
); |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* @covers FlexiPeeHP\FlexiBee::jsonizeData |
|
208
|
|
|
*/ |
|
209
|
|
|
public function testJsonizeData() |
|
210
|
|
|
{ |
|
211
|
|
|
$this->assertEquals('{"winstrom":{"@version":"1.0","'.$this->object->agenda.'":{"key":"value"}}}', |
|
212
|
|
|
$this->object->jsonizeData(['key' => 'value'])); |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
/** |
|
216
|
|
|
* @covers FlexiPeeHP\FlexiBee::insertToFlexiBee |
|
217
|
|
|
* @todo Implement testInsertToFlexiBee(). |
|
218
|
|
|
*/ |
|
219
|
|
|
public function testInsertToFlexiBee() |
|
220
|
|
|
{ |
|
221
|
|
|
// Remove the following lines when you implement this test. |
|
222
|
|
|
$this->markTestIncomplete( |
|
223
|
|
|
'This test has not been implemented yet.' |
|
224
|
|
|
); |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* @covers FlexiPeeHP\FlexiBee::idExists |
|
229
|
|
|
* @todo Implement testIdExists(). |
|
230
|
|
|
*/ |
|
231
|
|
|
public function testIdExists() |
|
232
|
|
|
{ |
|
233
|
|
|
// Remove the following lines when you implement this test. |
|
234
|
|
|
$this->markTestIncomplete( |
|
235
|
|
|
'This test has not been implemented yet.' |
|
236
|
|
|
); |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
/** |
|
240
|
|
|
* @covers FlexiPeeHP\FlexiBee::recordExists |
|
241
|
|
|
* @todo Implement testRecordExists(). |
|
242
|
|
|
*/ |
|
243
|
|
|
public function testRecordExists() |
|
244
|
|
|
{ |
|
245
|
|
|
// Remove the following lines when you implement this test. |
|
246
|
|
|
$this->markTestIncomplete( |
|
247
|
|
|
'This test has not been implemented yet.' |
|
248
|
|
|
); |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
/** |
|
252
|
|
|
* @covers FlexiPeeHP\FlexiBee::getColumnsFromFlexibee |
|
253
|
|
|
* @todo Implement testGetColumnsFromFlexibee(). |
|
254
|
|
|
*/ |
|
255
|
|
|
public function testGetColumnsFromFlexibee() |
|
256
|
|
|
{ |
|
257
|
|
|
// Remove the following lines when you implement this test. |
|
258
|
|
|
$this->markTestIncomplete( |
|
259
|
|
|
'This test has not been implemented yet.' |
|
260
|
|
|
); |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
/** |
|
264
|
|
|
* @covers FlexiPeeHP\FlexiBee::getKod |
|
265
|
|
|
* @todo Implement testGetKod(). |
|
266
|
|
|
*/ |
|
267
|
|
|
public function testGetKod() |
|
268
|
|
|
{ |
|
269
|
|
|
// Remove the following lines when you implement this test. |
|
270
|
|
|
$this->markTestIncomplete( |
|
271
|
|
|
'This test has not been implemented yet.' |
|
272
|
|
|
); |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
/** |
|
276
|
|
|
* @covers FlexiPeeHP\FlexiBee::searchString |
|
277
|
|
|
* @todo Implement testSearchString(). |
|
278
|
|
|
*/ |
|
279
|
|
|
public function testSearchString() |
|
280
|
|
|
{ |
|
281
|
|
|
// Remove the following lines when you implement this test. |
|
282
|
|
|
$this->markTestIncomplete( |
|
283
|
|
|
'This test has not been implemented yet.' |
|
284
|
|
|
); |
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
/** |
|
288
|
|
|
* @covers FlexiPeeHP\FlexiBee::logResult |
|
289
|
|
|
* @todo Implement testLogResult(). |
|
290
|
|
|
*/ |
|
291
|
|
|
public function testLogResult() |
|
292
|
|
|
{ |
|
293
|
|
|
// Remove the following lines when you implement this test. |
|
294
|
|
|
$this->markTestIncomplete( |
|
295
|
|
|
'This test has not been implemented yet.' |
|
296
|
|
|
); |
|
297
|
|
|
} |
|
298
|
|
|
|
|
299
|
|
|
/** |
|
300
|
|
|
* @covers FlexiPeeHP\FlexiBee::flexiUrl |
|
301
|
|
|
*/ |
|
302
|
|
|
public function testFlexiUrl() |
|
303
|
|
|
{ |
|
304
|
|
|
$this->assertEquals("a = 1 and b = 'foo'", |
|
305
|
|
|
$this->object->flexiUrl(['a' => 1, 'b' => 'foo'], 'and')); |
|
306
|
|
|
$this->assertEquals("a = 1 or b = 'bar'", |
|
307
|
|
|
$this->object->flexiUrl(['a' => 1, 'b' => 'bar'], 'or')); |
|
308
|
|
|
} |
|
309
|
|
|
} |
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: