KickBoxApiExceptionTest::testException()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 12
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Kickbox Bundle.
5
 *
6
 * (c) Abdoul Ndiaye <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Andi\KickBoxBundle\Tests\Exception;
13
14
use Andi\KickBoxBundle\Exception\KickBoxApiException;
15
use GuzzleHttp\Psr7\Request;
16
use GuzzleHttp\Psr7\Response;
17
18
/**
19
 * Class KickBoxApiExceptionTest
20
 *
21
 * @author Abdoul Ndiaye <[email protected]>
22
 *
23
 * @see Andi\KickBoxBundle\Exception\KickBoxApiException
24
 */
25
class KickBoxApiExceptionTest extends \PHPUnit_Framework_TestCase
26
{
27
    public function testException()
28
    {
29
        $httpResponse = new Response('expectedResponse');
30
        $e = new KickBoxApiException('test', new Request('', ''), $httpResponse);
31
        $this->assertEquals(
32
            'An error occurred during the api call : test',
33
            $e->getMessage(),
34
            'default message should be returned.'
35
        );
36
37
        $this->assertEquals($httpResponse->getBody(), $e->getResponse()->getBody());
38
    }
39
}
40