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
|
|
|
|