Completed
Push — refactoring ( f58f49 )
by Josef
45:19
created

ResponseFactoryTest::testCreateErrorResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace HelePartnerSyncApi\Response;
4
5
use Exception;
6
use PHPUnit_Framework_TestCase;
7
8
class ResponseFactoryTest extends PHPUnit_Framework_TestCase
9
{
10
11
	public function testCreateSuccessResponse()
12
	{
13
		$data = array(
14
			'key' => 'value',
15
		);
16
17
		$responseFactory = new ResponseFactory('secret');
18
		$response = $responseFactory->createSuccessResponse($data);
19
20
		$this->assertInstanceOf('HelePartnerSyncApi\Response\SuccessResponse', $response);
21
		$this->assertSame($data, $response->getData());
22
	}
23
24
	public function testCreateErrorResponse()
25
	{
26
		$exception = new Exception('Foo message');
27
28
		$responseFactory = new ResponseFactory('secret');
29
		$response = $responseFactory->createErrorResponse($exception);
30
31
		$this->assertInstanceOf('HelePartnerSyncApi\Response\ErrorResponse', $response);
32
		$this->assertSame(ErrorResponse::INTERNAL_SERVER_ERROR_MESSAGE, $response->getMessage());
33
	}
34
35
}
36