RESTfulExceptionTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetErrorCode() 0 13 1
1
<?php
2
3
namespace Postpay\Tests\Http;
4
5
use PHPUnit\Framework\TestCase;
6
use Postpay\Exceptions\RESTfulException;
7
use Postpay\Http\Request;
8
use Postpay\Http\Response;
9
10
class RESTfulExceptionTest extends TestCase
11
{
12
    public function testGetErrorCode()
13
    {
14
        $request = new Request('GET');
15
        $body = json_encode([
16
            RESTfulException::ERROR_KEY => [
17
                'code' => 'test'
18
            ],
19
        ]);
20
        $response = new Response($request, 400, [], $body);
21
        $exc = new RESTfulException($response);
22
23
        self::assertSame('test', $exc->getErrorCode());
24
    }
25
}
26