Completed
Push — master ( 170fde...562033 )
by Jan
03:08
created

ProcessPaymentRequestTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 6
dl 0
loc 33
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testSend() 0 28 1
1
<?php
2
3
namespace SlevomatCsobGateway\Call;
4
5
use SlevomatCsobGateway\Api\ApiClient;
6
use SlevomatCsobGateway\Api\Response;
7
use SlevomatCsobGateway\Api\ResponseCode;
8
9
class ProcessPaymentRequestTest extends \PHPUnit_Framework_TestCase
10
{
11
12
	public function testSend()
13
	{
14
		$apiClient = $this->getMockBuilder(ApiClient::class)
15
			->disableOriginalConstructor()
16
			->getMock();
17
18
		$apiClient->expects(self::once())->method('get')
19
			->with('payment/process/{merchantId}/{payId}/{dttm}/{signature}', [
20
				'merchantId' => '012345',
21
				'payId' => '123456789',
22
			])
23
			->willReturn(
24
				new Response(new ResponseCode(ResponseCode::S200_OK), [], [
25
					'Location' => 'https://platebnibrana.csob.cz/pay/vasobchod.cz/6544-4564-sd65111-GF544DS/',
26
				])
27
			);
28
29
		/** @var ApiClient $apiClient */
30
		$processPaymentRequest = new ProcessPaymentRequest(
31
			'012345',
32
			'123456789'
33
		);
34
35
		$processPaymentResponse = $processPaymentRequest->send($apiClient);
36
37
		$this->assertInstanceOf(ProcessPaymentResponse::class, $processPaymentResponse);
38
		$this->assertSame('https://platebnibrana.csob.cz/pay/vasobchod.cz/6544-4564-sd65111-GF544DS/', $processPaymentResponse->getGatewayLocationUrl());
39
	}
40
41
}
42