Passed
Branch real-time-api (b64dfc)
by James
03:20
created

EngagementServiceTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 24
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCanConstruct() 0 22 1
A setUp() 0 11 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: james
5
 * Date: 26/07/2018
6
 * Time: 10:18
7
 */
8
9
namespace CwsOps\LivePerson\Tests;
10
11
use CwsOps\LivePerson\Account\Config;
12
use CwsOps\LivePerson\Rest\Request;
13
use CwsOps\LivePerson\Services\EngagementService;
14
use PHPUnit\Framework\TestCase;
15
16
class EngagementServiceTest extends TestCase
17
{
18
19
    private $config;
20
21
    public function setUp()
22
    {
23
        require_once __DIR__ . '/../Services/MockClient.php';
24
25
        $accountId = 'foo';
26
        $consumerKey = 'bar';
27
        $consumerSecret = 'biz';
28
        $token = 'baz';
29
        $tokenSecret = 'bee';
30
        $username = 'noo';
31
        $this->config = new Config($accountId, $consumerKey, $consumerSecret, $token, $tokenSecret, $username);
32
    }
33
34
    /**
35
     * @covers \CwsOps\LivePerson\Services\AbstractService::__construct()
36
     * @covers \CwsOps\LivePerson\Services\AbstractService::getRequest()
37
     */
38
    public function testCanConstruct()
39
    {
40
41
        $accountId = 'foo';
42
        $consumerKey = 'bar';
43
        $consumerSecret = 'biz';
44
        $token = 'baz';
45
        $tokenSecret = 'bee';
46
        $username = 'noo';
47
        $this->config = new Config($accountId, $consumerKey, $consumerSecret, $token, $tokenSecret, $username);
48
49
        $service = new EngagementService($this->config);
50
51
        $res1 = new \stdClass();
52
        $res1->baseUri = 'test';
53
54
        $service->getRequest()->setClient(MockClient::getClient([
55
            MockClient::createResponse($res1)
56
        ]));
57
58
        $this->assertInstanceOf(EngagementService::class, $service);
59
        $this->assertInstanceOf(Request::class, $service->getRequest());
60
    }
61
}
62