ProcessPaymentRequestTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 1

1 Method

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