Code Duplication    Length = 32-32 lines in 2 locations

tests/unit/Call/ReceivePaymentRequestTest.php 2 locations

@@ 13-44 (lines=32) @@
10
class ReceivePaymentRequestTest extends \PHPUnit_Framework_TestCase
11
{
12
13
	public function testSend()
14
	{
15
		$postData = [
16
			'payId' => '123456789',
17
			'dttm' => '20140425131559',
18
			'resultCode' => 0,
19
			'resultMessage' => 'OK',
20
			'paymentStatus' => 5,
21
		];
22
23
		$apiClient = $this->getMockBuilder(ApiClient::class)
24
			->disableOriginalConstructor()
25
			->getMock();
26
27
		$apiClient->expects(self::once())->method('createResponseByData')
28
			->willReturnCallback(function (array $postData) {
29
				return new Response(new ResponseCode(ResponseCode::S200_OK), $postData);
30
			});
31
32
		/** @var ApiClient $apiClient */
33
		$receivePaymentRequest = new ReceivePaymentRequest();
34
35
		$paymentResponse = $receivePaymentRequest->send($apiClient, $postData);
36
37
		$this->assertInstanceOf(PaymentResponse::class, $paymentResponse);
38
		$this->assertSame('123456789', $paymentResponse->getPayId());
39
		$this->assertEquals(DateTimeImmutable::createFromFormat('YmdHis', '20140425131559'), $paymentResponse->getResponseDateTime());
40
		$this->assertEquals(new ResultCode(ResultCode::C0_OK), $paymentResponse->getResultCode());
41
		$this->assertSame('OK', $paymentResponse->getResultMessage());
42
		$this->assertEquals(new PaymentStatus(PaymentStatus::S5_REVOKED), $paymentResponse->getPaymentStatus());
43
		$this->assertNull($paymentResponse->getAuthCode());
44
	}
45
46
	public function testSendWithStringValues()
47
	{
@@ 46-77 (lines=32) @@
43
		$this->assertNull($paymentResponse->getAuthCode());
44
	}
45
46
	public function testSendWithStringValues()
47
	{
48
		$postData = [
49
			'payId' => '123456789',
50
			'dttm' => '20140425131559',
51
			'resultCode' => '0',
52
			'resultMessage' => 'OK',
53
			'paymentStatus' => '5',
54
		];
55
56
		$apiClient = $this->getMockBuilder(ApiClient::class)
57
			->disableOriginalConstructor()
58
			->getMock();
59
60
		$apiClient->expects(self::once())->method('createResponseByData')
61
			->willReturnCallback(function (array $postData) {
62
				return new Response(new ResponseCode(ResponseCode::S200_OK), $postData);
63
			});
64
65
		/** @var ApiClient $apiClient */
66
		$receivePaymentRequest = new ReceivePaymentRequest();
67
68
		$paymentResponse = $receivePaymentRequest->send($apiClient, $postData);
69
70
		$this->assertInstanceOf(PaymentResponse::class, $paymentResponse);
71
		$this->assertSame('123456789', $paymentResponse->getPayId());
72
		$this->assertEquals(DateTimeImmutable::createFromFormat('YmdHis', '20140425131559'), $paymentResponse->getResponseDateTime());
73
		$this->assertEquals(new ResultCode(ResultCode::C0_OK), $paymentResponse->getResultCode());
74
		$this->assertSame('OK', $paymentResponse->getResultMessage());
75
		$this->assertEquals(new PaymentStatus(PaymentStatus::S5_REVOKED), $paymentResponse->getPaymentStatus());
76
		$this->assertNull($paymentResponse->getAuthCode());
77
	}
78
79
}
80