|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace floor12\MindBox\Tests; |
|
4
|
|
|
|
|
5
|
|
|
use floor12\MindBox\MindBoxClient; |
|
6
|
|
|
use floor12\MindBox\Requests\CustomRequest; |
|
|
|
|
|
|
7
|
|
|
use PHPUnit\Framework\TestCase; |
|
8
|
|
|
|
|
9
|
|
|
class MindBoxRequestTest extends TestCase |
|
10
|
|
|
{ |
|
11
|
|
|
/** @var TestRequest */ |
|
12
|
|
|
private $testRequest; |
|
13
|
|
|
|
|
14
|
|
|
public function setUp() |
|
15
|
|
|
{ |
|
16
|
|
|
$this->testRequest = new TestRequest(); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
public function testSetMode() |
|
20
|
|
|
{ |
|
21
|
|
|
$this->testRequest->setMode(MindBoxClient::MODE_ASYNCHRONOUS); |
|
22
|
|
|
$this->assertEquals(MindBoxClient::MODE_ASYNCHRONOUS, $this->testRequest->getMode()); |
|
23
|
|
|
|
|
24
|
|
|
$this->testRequest->setMode(MindBoxClient::MODE_SYNCHRONOUS); |
|
25
|
|
|
$this->assertEquals(MindBoxClient::MODE_SYNCHRONOUS, $this->testRequest->getMode()); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function testGetBodyAsJson() |
|
29
|
|
|
{ |
|
30
|
|
|
$this->testRequest->setMode(MindBoxClient::MODE_ASYNCHRONOUS); |
|
31
|
|
|
$this->testRequest->setBody(['test' => ['some' => 'data']]); |
|
32
|
|
|
$this->assertEquals(json_encode($this->testRequest->getBody()), $this->testRequest->getBodyAsJson()); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function testIsAsync() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->testRequest->setMode(MindBoxClient::MODE_ASYNCHRONOUS); |
|
38
|
|
|
$this->assertTrue($this->testRequest->isAsync()); |
|
39
|
|
|
|
|
40
|
|
|
$this->testRequest->setMode(MindBoxClient::MODE_SYNCHRONOUS); |
|
41
|
|
|
$this->assertFalse($this->testRequest->isAsync()); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function testSetDeviceUUID() |
|
45
|
|
|
{ |
|
46
|
|
|
$deviceUUID = md5(time()); |
|
47
|
|
|
$this->testRequest->setDeviceUUID($deviceUUID); |
|
48
|
|
|
$this->assertEquals($deviceUUID, $this->testRequest->getDeviceUUID()); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function testSetBody() |
|
52
|
|
|
{ |
|
53
|
|
|
$testBody = ['test' => ['some' => 'data']]; |
|
54
|
|
|
$this->testRequest->setBody($testBody); |
|
55
|
|
|
$this->assertEquals($testBody, $this->testRequest->getBody()); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function testSetOperationName() |
|
59
|
|
|
{ |
|
60
|
|
|
$operationName = 'testOperationName'; |
|
61
|
|
|
$this->testRequest->setOperationName($operationName); |
|
62
|
|
|
$this->assertEquals($operationName, $this->testRequest->getOperationName()); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths