Completed
Push — master ( 582b13...3337a2 )
by Vítězslav
03:27
created

objTest::method()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Test\FlexiPeeHP;
4
5
use FlexiPeeHP\FlexiBee;
6
7
/**
8
 * Class used to test Object To Array Conversion
9
 */
10
class objTest extends \stdClass
11
{
12
    /**
13
     * Simple Item
14
     * @var integer
15
     */
16
    public $item = 1;
17
18
    /**
19
     * Array item
20
     * @var array
21
     */
22
    public $arrItem = ['a', 'b' => 'c'];
23
24
    /**
25
     * Simple method
26
     * 
27
     * @return boolean
28
     */
29
    public function method()
30
    {
31
        return true;
32
    }
33
}
34
35
/**
36
 * Generated by PHPUnit_SkeletonGenerator on 2016-05-04 at 10:08:36.
37
 */
38
class FlexiBeeTest extends \Test\Ease\BrickTest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
39
{
40
    /**
41
     * @var FlexiBee
42
     */
43
    protected $object;
44
45
    /**
46
     * Sets up the fixture, for example, opens a network connection.
47
     * This method is called before a test is executed.
48
     * @covers FlexiPeeHP\FlexiBee::__construct
49
     */
50
    protected function setUp()
51
    {
52
        $this->object = new FlexiBee;
53
    }
54
55
    /**
56
     * Tears down the fixture, for example, closes a network connection.
57
     * This method is called after a test is executed.
58
     */
59
    protected function tearDown()
60
    {
61
        
62
    }
63
64
    public function testCurlInit()
65
    {
66
        $this->object->curlInit();
67
        $this->assertTrue(is_resource($this->object->curl));
68
    }
69
70
    /**
71
     * @covers FlexiPeeHP\FlexiBee::setAgenda
72
     */
73
    public function testSetAgenda()
74
    {
75
        $this->object->setAgenda('nastaveni');
76
        $this->assertEquals('nastaveni', $this->object->agenda);
77
    }
78
79
    /**
80
     * @covers FlexiPeeHP\FlexiBee::object2array
81
     */
82
    public function testObject2array()
83
    {
84
        $this->assertNull($this->object->object2array(new \stdClass()));
85
        $this->assertEquals(
86
            [
87
            'item' => 1,
88
            'arrItem' => ['a', 'b' => 'c']
89
            ]
90
            , $this->object->object2array(new objTest()));
91
    }
92
93
    /**
94
     * @covers FlexiPeeHP\FlexiBee::performRequest
95
     */
96
    public function testPerformRequest()
97
    {
98
99
        if (!is_null($this->object->agenda) && $this->object->agenda != 'test') {
100
            $json = $this->object->performRequest($this->object->agenda.'.json');
101
            if (array_key_exists('message', $json)) {
102
                $this->assertArrayHasKey('@version', $json);
103
            } else {
104
                $this->assertArrayHasKey($this->object->agenda, $json);
105
            }
106
        } else {
107
            $this->object->agenda    = 'c';
108
            $this->object->prefix    = '';
109
            $this->object->company   = '';
0 ignored issues
show
Documentation Bug introduced by
It seems like '' of type string is incompatible with the declared type object<FlexiPeeHP\type> of property $company.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
110
            $this->object->nameSpace = 'companies';
111
            $json                    = $this->object->performRequest();
112
            $this->assertArrayHasKey('company', $json);
113
114
            $xml = $this->object->performRequest(null, null, 'xml');
115
            $this->assertArrayHasKey('company', $xml);
116
        }
117
    }
118
119
    /**
120
     * @covers FlexiPeeHP\FlexiBee::getLastImportId
121
     * @todo   Implement testGetLastImportId().
122
     */
123
    public function testGetLastImportId()
124
    {
125
        // Remove the following lines when you implement this test.
126
        $this->markTestIncomplete(
127
            'This test has not been implemented yet.'
128
        );
129
    }
130
131
    /**
132
     * @covers FlexiPeeHP\FlexiBee::xml2array
133
     * @todo   Implement testXml2array().
134
     */
135
    public function testXml2array()
136
    {
137
        // Remove the following lines when you implement this test.
138
        $this->markTestIncomplete(
139
            'This test has not been implemented yet.'
140
        );
141
    }
142
143
    /**
144
     * @covers FlexiPeeHP\FlexiBee::disconnect
145
     * @todo   Implement testDisconnect().
146
     */
147
    public function testDisconnect()
148
    {
149
        // Remove the following lines when you implement this test.
150
        $this->markTestIncomplete(
151
            'This test has not been implemented yet.'
152
        );
153
    }
154
155
    /**
156
     * @covers FlexiPeeHP\FlexiBee::__destruct
157
     * @todo   Implement test__destruct().
158
     */
159
    public function test__destruct()
160
    {
161
        // Remove the following lines when you implement this test.
162
        $this->markTestIncomplete(
163
            'This test has not been implemented yet.'
164
        );
165
    }
166
167
    /**
168
     * @covers FlexiPeeHP\FlexiBee::loadFlexiData
169
     * @todo   Implement testLoadFlexiData().
170
     */
171
    public function testLoadFlexiData()
172
    {
173
        // Remove the following lines when you implement this test.
174
        $this->markTestIncomplete(
175
            'This test has not been implemented yet.'
176
        );
177
    }
178
179
    /**
180
     * @covers FlexiPeeHP\FlexiBee::getFlexiRow
181
     * @todo   Implement testGetFlexiRow().
182
     */
183
    public function testGetFlexiRow()
184
    {
185
        // Remove the following lines when you implement this test.
186
        $this->markTestIncomplete(
187
            'This test has not been implemented yet.'
188
        );
189
    }
190
191
    /**
192
     * @covers FlexiPeeHP\FlexiBee::getFlexiData
193
     * @todo   Implement testGetFlexiData().
194
     */
195
    public function testGetFlexiData()
196
    {
197
        // Remove the following lines when you implement this test.
198
        $this->markTestIncomplete(
199
            'This test has not been implemented yet.'
200
        );
201
    }
202
203
    /**
204
     * @covers FlexiPeeHP\FlexiBee::loadFromFlexiBee
205
     * @todo   Implement testLoadFromFlexiBee().
206
     */
207
    public function testLoadFromFlexiBee()
208
    {
209
        // Remove the following lines when you implement this test.
210
        $this->markTestIncomplete(
211
            'This test has not been implemented yet.'
212
        );
213
    }
214
215
    /**
216
     * @covers FlexiPeeHP\FlexiBee::saveToFlexiBee
217
     * @todo   Implement testSaveToFlexiBee().
218
     */
219
    public function testSaveToFlexiBee()
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::jsonizeData
229
     */
230
    public function testJsonizeData()
231
    {
232
        $this->assertEquals('{"winstrom":{"@version":"1.0","'.$this->object->agenda.'":{"key":"value"}}}',
233
            $this->object->jsonizeData(['key' => 'value']));
234
    }
235
236
    /**
237
     * @covers FlexiPeeHP\FlexiBee::insertToFlexiBee
238
     * @todo   Implement testInsertToFlexiBee().
239
     */
240
    public function testInsertToFlexiBee()
241
    {
242
        // Remove the following lines when you implement this test.
243
        $this->markTestIncomplete(
244
            'This test has not been implemented yet.'
245
        );
246
    }
247
248
    /**
249
     * @covers FlexiPeeHP\FlexiBee::idExists
250
     * @todo   Implement testIdExists().
251
     */
252
    public function testIdExists()
253
    {
254
        // Remove the following lines when you implement this test.
255
        $this->markTestIncomplete(
256
            'This test has not been implemented yet.'
257
        );
258
    }
259
260
    /**
261
     * @covers FlexiPeeHP\FlexiBee::recordExists
262
     * @todo   Implement testRecordExists().
263
     */
264
    public function testRecordExists()
265
    {
266
        // Remove the following lines when you implement this test.
267
        $this->markTestIncomplete(
268
            'This test has not been implemented yet.'
269
        );
270
    }
271
272
    /**
273
     * @covers FlexiPeeHP\FlexiBee::getColumnsFromFlexibee
274
     * @todo   Implement testGetColumnsFromFlexibee().
275
     */
276
    public function testGetColumnsFromFlexibee()
277
    {
278
        // Remove the following lines when you implement this test.
279
        $this->markTestIncomplete(
280
            'This test has not been implemented yet.'
281
        );
282
    }
283
284
    /**
285
     * @covers FlexiPeeHP\FlexiBee::getKod
286
     * @todo   Implement testGetKod().
287
     */
288
    public function testGetKod()
289
    {
290
        // Remove the following lines when you implement this test.
291
        $this->markTestIncomplete(
292
            'This test has not been implemented yet.'
293
        );
294
    }
295
296
    /**
297
     * @covers FlexiPeeHP\FlexiBee::searchString
298
     * @todo   Implement testSearchString().
299
     */
300
    public function testSearchString()
301
    {
302
        // Remove the following lines when you implement this test.
303
        $this->markTestIncomplete(
304
            'This test has not been implemented yet.'
305
        );
306
    }
307
308
    /**
309
     * @covers FlexiPeeHP\FlexiBee::logResult
310
     * @todo   Implement testLogResult().
311
     */
312
    public function testLogResult()
313
    {
314
        // Remove the following lines when you implement this test.
315
        $this->markTestIncomplete(
316
            'This test has not been implemented yet.'
317
        );
318
    }
319
320
    /**
321
     * @covers FlexiPeeHP\FlexiBee::flexiUrl
322
     */
323
    public function testFlexiUrl()
324
    {
325
        $this->assertEquals("a = 1 and b = 'foo'",
326
            $this->object->flexiUrl(['a' => 1, 'b' => 'foo'], 'and'));
327
        $this->assertEquals("a = 1 or b = 'bar'",
328
            $this->object->flexiUrl(['a' => 1, 'b' => 'bar'], 'or'));
329
    }
330
}