Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
25 / 25 |
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 | use AppDemo\Library\Domain\BookStatus; |
| 11 | |
| 12 | test('Label returns correct human-readable strings', function (): void { |
| 13 | expect(BookStatus::Available->label())->toBe('Available') |
| 14 | ->and(BookStatus::Borrowed->label())->toBe('Borrowed') |
| 15 | ; |
| 16 | }); |
| 17 | |
| 18 | test('isAvailable() returns true only for Available', function (): void { |
| 19 | expect(BookStatus::Available->isAvailable())->toBeTrue() |
| 20 | ->and(BookStatus::Borrowed->isAvailable())->toBeFalse() |
| 21 | ; |
| 22 | }); |
| 23 | |
| 24 | test('isBorrowed() returns true only for Borrowed', function (): void { |
| 25 | expect(BookStatus::Borrowed->isBorrowed())->toBeTrue() |
| 26 | ->and(BookStatus::Available->isBorrowed())->toBeFalse() |
| 27 | ; |
| 28 | }); |
| 29 | |
| 30 | test('canBeBorrowed() returns true only for Available', function (): void { |
| 31 | expect(BookStatus::Available->canBeBorrowed())->toBeTrue() |
| 32 | ->and(BookStatus::Borrowed->canBeBorrowed())->toBeFalse() |
| 33 | ; |
| 34 | }); |
| 35 | |
| 36 | test('canBeReturned() returns true only for Borrowed', function (): void { |
| 37 | expect(BookStatus::Borrowed->canBeReturned())->toBeTrue() |
| 38 | ->and(BookStatus::Available->canBeReturned())->toBeFalse() |
| 39 | ; |
| 40 | }); |