Skip to content
This repository was archived by the owner on Jul 29, 2020. It is now read-only.

Commit 8b4ce59

Browse files
committed
unit tests update
1 parent 38668b1 commit 8b4ce59

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

testing/src/FlexiPeeHP/FlexiBeeROTest.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ public function testConstructor()
9494

9595
$mock->__construct('',
9696
[
97-
'company' => constant('FLEXIBEE_COMPANY'),
98-
'url' => constant('FLEXIBEE_URL'),
99-
'user' => constant('FLEXIBEE_LOGIN'),
100-
'password' => constant('FLEXIBEE_PASSWORD'),
101-
'debug' => true,
102-
'prefix' => 'c',
103-
'evidence' => $evidence]);
97+
'company' => constant('FLEXIBEE_COMPANY'),
98+
'url' => constant('FLEXIBEE_URL'),
99+
'user' => constant('FLEXIBEE_LOGIN'),
100+
'password' => constant('FLEXIBEE_PASSWORD'),
101+
'debug' => true,
102+
'prefix' => 'c',
103+
'evidence' => $evidence]);
104104
}
105105

106106
/**
@@ -128,7 +128,7 @@ public function testProcessInit()
128128
$firstID = $this->object->getColumnsFromFlexibee(['id', 'kod'],
129129
['limit' => 1]);
130130

131-
if (count($firstID) && isset($firstID[0]['id'])) {
131+
if (!empty($firstID) && isset($firstID[0]['id'])) {
132132

133133
$this->object->processInit((int) current($firstID));
134134
$this->assertNotEmpty($this->object->__toString());
@@ -242,8 +242,8 @@ public function testObject2array()
242242
$this->assertNull($this->object->object2array(new \stdClass()));
243243
$this->assertEquals(
244244
[
245-
'item' => 1,
246-
'arrItem' => ['a', 'b' => 'c']
245+
'item' => 1,
246+
'arrItem' => ['a', 'b' => 'c']
247247
]
248248
, $this->object->object2array(new \Test\ObjectForTesting()));
249249
}
@@ -322,7 +322,7 @@ public function testRawJsonToArray()
322322
[
323323
[
324324
'id' => '2574',
325-
'kontakty' =>
325+
$this->object->getResponseEvidence() =>
326326
[
327327
['id' => '299']
328328
]
@@ -809,10 +809,9 @@ public function testGetApiUrl()
809809
public function testGetResponseFormat()
810810
{
811811
$this->object->performRequest(null, 'GET', 'json');
812-
$this->assertEquals('application/json',
813-
$this->object->getResponseFormat());
812+
$this->assertEquals('json', $this->object->getResponseFormat());
814813
$this->object->performRequest(null, 'GET', 'xml');
815-
$this->assertEquals('application/xml',
814+
$this->assertEquals('xml',
816815
$this->object->getResponseFormat());
817816
unset($this->object->curlInfo['content_type']);
818817
$this->assertNull($this->object->getResponseFormat());
@@ -1213,13 +1212,14 @@ public function testFlexiDateTimeToDateTime()
12131212
*/
12141213
public function testTakeData()
12151214
{
1215+
$responseEvidence = $this->object->getResponseEvidence();
12161216
$this->object->takeData(['id' => 1]);
1217-
$this->assertEquals(constant('FLEXIBEE_URL').'/'.constant('FLEXIBEE_COMPANY').'/1',
1217+
$this->assertEquals(constant('FLEXIBEE_URL').'/c/'.constant('FLEXIBEE_COMPANY').'/'.$responseEvidence.'/1',
12181218
$this->object->getApiURL());
12191219

12201220
$this->object->dataReset();
12211221
$this->object->takeData(['kod' => 'test']);
1222-
$this->assertEquals(constant('FLEXIBEE_URL').'/'.constant('FLEXIBEE_COMPANY').'/code:TEST',
1222+
$this->assertEquals(constant('FLEXIBEE_URL').'/c/'.constant('FLEXIBEE_COMPANY').'/'.$responseEvidence.'/code:TEST',
12231223
$this->object->getApiURL());
12241224
}
12251225

@@ -1333,6 +1333,7 @@ public function testSendByMail()
13331333
{
13341334
$this->object->sendByMail($this->object->reportRecipient, 'test',
13351335
'test body');
1336+
$this->assertTrue(true);
13361337
}
13371338

13381339
/**
@@ -1341,6 +1342,7 @@ public function testSendByMail()
13411342
public function testSendUnsent()
13421343
{
13431344
$this->object->sendUnsent();
1345+
$this->assertTrue(true);
13441346
}
13451347

13461348
/**
@@ -1355,6 +1357,7 @@ public function testGetInFormat()
13551357
$this->object->getInFormat('pdf', 'test');
13561358
$this->object->getInFormat('pdf', 'test', 'cs', true);
13571359
$this->object->getInFormat('pdf', 'error', 'ua', false);
1360+
$this->assertTrue(true);
13581361
}
13591362

13601363
/**
@@ -1363,6 +1366,7 @@ public function testGetInFormat()
13631366
public function testDownloadInFormat()
13641367
{
13651368
$this->object->downloadInFormat('pdf', sys_get_temp_dir().'/');
1369+
$this->assertTrue(true);
13661370
}
13671371

13681372
/**
@@ -1378,6 +1382,7 @@ public function testGetReportsInfo()
13781382
case 'status':
13791383
case 'changes':
13801384
case 'evidence-list':
1385+
$this->assertTrue(true);
13811386
break;
13821387
default:
13831388
$this->assertNotEmpty($result,
@@ -1418,5 +1423,4 @@ public function testWakeup()
14181423
{
14191424
$this->object->__wakeup();
14201425
}
1421-
14221426
}

0 commit comments

Comments
 (0)