testClientException()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace LoLApi\Tests\Exception;
4
5
use GuzzleHttp\Exception\ClientException;
6
use GuzzleHttp\Psr7\Request;
7
use GuzzleHttp\Psr7\Response;
8
use LoLApi\Exception\ServiceRateLimitException;
9
10
/**
11
 * Class AbstractRateLimitExceptionTest
12
 *
13
 * @package LoLApi\Tests\Exception
14
 */
15
class AbstractRateLimitExceptionTest extends \PHPUnit_Framework_TestCase
16
{
17
    /**
18
     * @covers LoLApi\Exception\ServiceRateLimitException::getClientException
19
     * @covers LoLApi\Exception\ServiceRateLimitException::setClientException
20
     */
21
    public function testClientException()
22
    {
23
        $response                  = new Response(400);
24
        $request                   = new Request('GET', 'test');
25
        $clientException           = new ClientException('test', $request, $response);
26
        $serviceRateLimitException = new ServiceRateLimitException();
27
28
        $this->assertEquals($serviceRateLimitException, $serviceRateLimitException->setClientException($clientException));
29
        $this->assertEquals($clientException, $serviceRateLimitException->getClientException());
30
    }
31
32
    /**
33
     * @covers LoLApi\Exception\ServiceRateLimitException::setRetryAfter
34
     * @covers LoLApi\Exception\ServiceRateLimitException::getRetryAfter
35
     */
36
    public function testRetryAfter()
37
    {
38
        $serviceRateLimitException = new ServiceRateLimitException();
39
        $retryAfter                = 10;
40
41
        $this->assertSame($serviceRateLimitException, $serviceRateLimitException->setRetryAfter($retryAfter));
42
        $this->assertSame($retryAfter, $serviceRateLimitException->getRetryAfter());
43
    }
44
}
45