Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
15 / 15 |
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\Homepage\Application\UseCase\HomeResponse; |
| 13 | use AppDemo\Homepage\Presentation\HomeHtmlPresenter; |
| 14 | |
| 15 | describe('Presentation', function (): void { |
| 16 | it('maps greeting, message of the day, and formats date', function (): void { |
| 17 | $response = new HomeResponse( |
| 18 | greeting: 'Hello, World!', |
| 19 | messageOfTheDay: 'Read more books today.', |
| 20 | currentDateTime: new DateTimeImmutable('2026-03-01 14:05:30') |
| 21 | ); |
| 22 | |
| 23 | $viewModel = new HomeHtmlPresenter()->present($response)->getViewModel(); |
| 24 | |
| 25 | expect($viewModel->greeting)->toBe('Hello, World!') |
| 26 | ->and($viewModel->messageOfTheDay)->toBe('Read more books today.') |
| 27 | ->and($viewModel->currentDateTime)->toBe('2026-03-01 14:05:30') |
| 28 | ; |
| 29 | }); |
| 30 | }); |