| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 12 |
| 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' => ['createFromResponseTest'], |
||
| 27 | ]; |
||
| 28 | |||
| 29 | $purchaseBuilderMock = Mockery::mock(PurchaseBuilderInterface::class); |
||
| 30 | $purchaseBuilderMock->shouldReceive('buildFromArray')->once()->with($data['purchases'])->andReturn([]); |
||
| 31 | |||
| 32 | $builder = new PurchaseHistoryBuilder($purchaseBuilderMock); |
||
| 33 | $purchaseHistory = $builder->buildFromJson(json_encode($data)); |
||
| 34 | |||
| 35 | self::assertInstanceOf(PurchaseHistory::class, $purchaseHistory); |
||
| 36 | self::assertSame($firstPurchaseHash, $purchaseHistory->getFirstPurchaseHash()); |
||
| 37 | self::assertSame($lastPurchaseHash, $purchaseHistory->getLastPurchaseHash()); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |