| Conditions | 1 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function createFromResponse(): void |
||
| 22 | { |
||
| 23 | $data = [ |
||
| 24 | 'firstPurchaseHash' => $firstPurchaseHash = 'hash1', |
||
| 25 | 'lastPurchaseHash' => $lastPurchaseHash = 'hash2', |
||
| 26 | 'purchases' => [], |
||
| 27 | ]; |
||
| 28 | |||
| 29 | $responseMock = Mockery::mock(ResponseInterface::class); |
||
| 30 | $responseMock->shouldReceive('getBody')->andReturnSelf(); |
||
| 31 | $responseMock->shouldReceive('getContents')->andReturn(json_encode( |
||
| 32 | $data |
||
| 33 | )); |
||
| 34 | |||
| 35 | $purchaseHistory = PurchaseHistoryParser::createFromResponse($responseMock); |
||
| 36 | |||
| 37 | self::assertInstanceOf(PurchaseHistory::class, $purchaseHistory); |
||
| 38 | self::assertSame($firstPurchaseHash, $purchaseHistory->getFirstPurchaseHash()); |
||
| 39 | self::assertSame($lastPurchaseHash, $purchaseHistory->getLastPurchaseHash()); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |