Conditions | 1 |
Paths | 1 |
Total Lines | 33 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
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 | ->with($postData) |
||
29 | ->willReturn( |
||
30 | new Response(new ResponseCode(ResponseCode::S200_OK), $postData) |
||
31 | ); |
||
32 | |||
33 | /** @var ApiClient $apiClient */ |
||
34 | $receivePaymentRequest = new ReceivePaymentRequest(); |
||
35 | |||
36 | $paymentResponse = $receivePaymentRequest->send($apiClient, $postData); |
||
37 | |||
38 | $this->assertInstanceOf(PaymentResponse::class, $paymentResponse); |
||
39 | $this->assertSame('123456789', $paymentResponse->getPayId()); |
||
40 | $this->assertEquals(DateTimeImmutable::createFromFormat('YmdHis', '20140425131559'), $paymentResponse->getResponseDateTime()); |
||
41 | $this->assertEquals(new ResultCode(ResultCode::C0_OK), $paymentResponse->getResultCode()); |
||
42 | $this->assertSame('OK', $paymentResponse->getResultMessage()); |
||
43 | $this->assertEquals(new PaymentStatus(PaymentStatus::S5_REVOKED), $paymentResponse->getPaymentStatus()); |
||
44 | $this->assertNull($paymentResponse->getAuthCode()); |
||
45 | } |
||
46 | |||
48 |