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

RequestTest::testCanConstructWithDefaultOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: james
5
 * Date: 19/07/2018
6
 * Time: 09:46
7
 */
8
9
namespace CwsOps\LivePerson\Tests;
10
11
use CwsOps\LivePerson\Account\Config;
12
use CwsOps\LivePerson\Rest\Request;
13
14
use GuzzleHttp\Client;
15
use PHPUnit\Framework\TestCase;
16
17
/**
18
 * Class RequestTest
19
 *
20
 * @package CwsOps\LivePerson\Tests
21
 */
22
class RequestTest extends TestCase
23
{
24
25
    private $config;
26
27
    public function setUp()
28
    {
29
        $accountId = 'foo';
30
        $consumerKey = 'bar';
31
        $consumerSecret = 'biz';
32
        $token = 'baz';
33
        $tokenSecret = 'bee';
34
        $username = 'noo';
35
        $this->config = new Config($accountId, $consumerKey, $consumerSecret, $token, $tokenSecret, $username);
36
    }
37
38
    /**
39
     *
40
     * @covers \CwsOps\LivePerson\Rest\Request::__construct
41
     */
42
    public function testCanConstructWithDefaultOptions()
43
    {
44
        $request = new Request($this->config);
45
46
        $this->assertInstanceOf(Request::class, $request);
47
    }
48
49
    /**
50
     * @covers \CwsOps\LivePerson\Rest\Request::getClient()
51
     * @covers \CwsOps\LivePerson\Rest\Request::setClient()
52
     */
53
    public function testCanSetAndGetClient()
54
    {
55
        require_once __DIR__ . '/Services/MockClient.php';
56
57
        $request = new Request($this->config);
58
59
        $this->assertInstanceOf(Client::class, $request->getClient());
60
61
        $request->setClient(MockClient::getClient([]));
62
63
        $this->assertInstanceOf(Client::class, $request->getClient());
64
    }
65
}
66