Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
12 / 12 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | // ╔════════════════════════════════════════════════════════════╗ |
| 4 | // ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║ |
| 5 | // ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com> ║ |
| 6 | // ╚════════════════════════════════════════════════════════════╝ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | pest()->group('unit'); |
| 11 | |
| 12 | use AppDemo\Loan\Application\Query\MyLoansResponse; |
| 13 | use AppDemo\Loan\Presentation\MyLoansHtmlPresenter; |
| 14 | use AppDemo\Loan\Presentation\MyLoansHtmlViewModel; |
| 15 | |
| 16 | describe('Presentation', function (): void { |
| 17 | it('maps loans and calculates count', function (): void { |
| 18 | $loans = [['id' => 1], ['id' => 2], ['id' => 3]]; |
| 19 | $response = new MyLoansResponse(loans: $loans); |
| 20 | |
| 21 | $viewModel = new MyLoansHtmlPresenter()->present($response)->getViewModel(); |
| 22 | |
| 23 | expect($viewModel)->toBeInstanceOf(MyLoansHtmlViewModel::class) |
| 24 | ->and($viewModel->loans)->toBe($loans) |
| 25 | ->and($viewModel->count)->toBe(3) |
| 26 | ; |
| 27 | }); |
| 28 | }); |