Completed
Push — dev ( ce9639...c420bb )
by Josef
04:04
created

ErrorResponseTest::testInternalError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace HelePartnerSyncApi\Response;
4
5
use Exception;
6
use HelePartnerSyncApi\Request\RequestException;
7
use PHPUnit_Framework_TestCase;
8
9
class ErrorResponseTest extends PHPUnit_Framework_TestCase
10
{
11
12
	public function test()
13
	{
14
		$message = 'foo message';
15
		$exception = new RequestException($message);
16
		$response = new ErrorResponse('secret', $exception);
17
18
		$this->assertSame($exception, $response->getException());
19
		$this->assertSame($message, $response->getMessage());
20
		$this->assertNull($response->getData());
21
		$this->assertFalse($response->isSuccessful());
22
	}
23
24
	public function testInternalError()
25
	{
26
		$exception = new Exception(uniqid());
27
		$response = new ErrorResponse('secret', $exception);
28
29
		$this->assertSame($exception, $response->getException());
30
		$this->assertSame('Internal server error', $response->getMessage());
31
		$this->assertNull($response->getData());
32
		$this->assertFalse($response->isSuccessful());
33
	}
34
35
}
36