1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* File: ListsGetHandlerTest.php |
4
|
|
|
* |
5
|
|
|
* @author Maciej Sławik <[email protected]> |
6
|
|
|
* Github: https://github.com/maciejslawik |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace MSlwk\FreshMail\Test\Lists; |
10
|
|
|
|
11
|
|
|
use MSlwk\FreshMail\Handler\Lists\ListsGetHandler; |
12
|
|
|
use MSlwk\FreshMail\Tests\BaseTest; |
13
|
|
|
use PHPUnit\Framework\TestCase; |
14
|
|
|
use MSlwk\FreshMail\Error\ErrorHandler; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class ListsGetHandlerTest |
18
|
|
|
* |
19
|
|
|
* @package MSlwk\FreshMail\Test\Lists |
20
|
|
|
*/ |
21
|
|
|
class ListsGetHandlerTest extends TestCase |
22
|
|
|
{ |
23
|
|
|
use BaseTest; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @param $sendRequestReturnValue |
27
|
|
|
* @return \PHPUnit_Framework_MockObject_MockObject |
|
|
|
|
28
|
|
|
*/ |
29
|
|
|
public function getListsGetHandlerMock($sendRequestReturnValue) |
30
|
|
|
{ |
31
|
|
|
$listsGetHandler = $this->getMockBuilder('\MSlwk\FreshMail\Handler\Lists\ListsGetHandler') |
|
|
|
|
32
|
|
|
->setConstructorArgs([new ErrorHandler(), '', '']) |
33
|
|
|
->setMethods(['sendRequest']) |
34
|
|
|
->getMock(); |
35
|
|
|
|
36
|
|
|
$listsGetHandler->expects($this->once()) |
37
|
|
|
->method('sendRequest') |
38
|
|
|
->will($this->returnValue($sendRequestReturnValue)); |
39
|
|
|
|
40
|
|
|
return $listsGetHandler; |
|
|
|
|
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function testListsPulledSuccessfully() |
44
|
|
|
{ |
45
|
|
|
$expectedListsPulled = [ |
46
|
|
|
(object) [ |
47
|
|
|
'hash' => '4124521421', |
48
|
|
|
'name' => 'h4htrbg', |
49
|
|
|
'description' => '145r3fgrvfe', |
50
|
|
|
'creation_date' => '41253525teegf', |
51
|
|
|
'subscribers_number' => 2 |
52
|
|
|
], |
53
|
|
|
(object) [ |
54
|
|
|
'hash' => 'vsdv', |
55
|
|
|
'name' => 'cbcsxb', |
56
|
|
|
'description' => 'czvczv', |
57
|
|
|
'creation_date' => 'byr6j5', |
58
|
|
|
'subscribers_number' => 5 |
59
|
|
|
], |
60
|
|
|
]; |
61
|
|
|
$listsGetHandler = $this->getListsGetHandlerMock( |
62
|
|
|
'{"status":"OK","lists":' . json_encode($expectedListsPulled) . '}' |
63
|
|
|
); |
64
|
|
|
$returnedData = $listsGetHandler->getSubscriberLists(); |
65
|
|
|
self::assertEquals($expectedListsPulled, $returnedData); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function testApiEndpoint() |
69
|
|
|
{ |
70
|
|
|
$listCreateHandler = new ListsGetHandler(new ErrorHandler(), '', ''); |
71
|
|
|
$expectedApiEndpoint = '/rest/subscribers_list/lists'; |
72
|
|
|
$returnedApiEndpoint = $this->getApiEndpoint($listCreateHandler); |
73
|
|
|
self::assertEquals($expectedApiEndpoint, $returnedApiEndpoint); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
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