ProcessPaymentRequestTest::testSend()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 15
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 26
rs 9.7666
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