Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| FakeInvoicesService | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| retrieve | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\StockIO\Mocks; |
| 4 | |
| 5 | use App\Models\Product\Product; |
| 6 | |
| 7 | readonly class FakeInvoicesService |
| 8 | { |
| 9 | public function retrieve(int $amount = 5): array |
| 10 | { |
| 11 | return [ |
| 12 | 'invoice_number' => '0000000', |
| 13 | 'products' => Product::query() |
| 14 | ->inRandomOrder() |
| 15 | ->limit($amount) |
| 16 | ->get() |
| 17 | ->map(function (Product $product) { |
| 18 | if (!$product->integration) { |
| 19 | return false; |
| 20 | } |
| 21 | return [ |
| 22 | 'key' => $product->integration->getAttribute('parameters')['integration_product'], |
| 23 | 'description' => $product->getAttribute('description'), |
| 24 | 'amount' => 50, |
| 25 | ]; |
| 26 | })->filter()->toArray() |
| 27 | ]; |
| 28 | } |
| 29 | } |