Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| LoanListLoansContext | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| thenIShouldSeeLoans | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| thenIShouldSeeALoanForUserWithBook | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 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 | namespace Tests\AppDemo\Acceptance; |
| 11 | |
| 12 | use Assert\Assert; |
| 13 | use Behat\Step\Then; |
| 14 | use Exception; |
| 15 | use Nyholm\Psr7\Response; |
| 16 | use Tests\AppDemo\Acceptance\Trait\BrowsePageTrait; |
| 17 | |
| 18 | final class LoanListLoansContext extends BehatContext |
| 19 | { |
| 20 | use BrowsePageTrait; |
| 21 | |
| 22 | private Response $response; |
| 23 | |
| 24 | private ?Exception $exception = null; |
| 25 | |
| 26 | #[Then('I should see :count loans')] |
| 27 | public function thenIShouldSeeLoans(int $count): void |
| 28 | { |
| 29 | $body = (string) $this->response->getBody(); |
| 30 | |
| 31 | Assert::that($body)->contains('Total number of loans: <strong>'.$count.'</strong>'); |
| 32 | } |
| 33 | |
| 34 | #[Then('I should see a loan for user ":userEmail" with book ":bookTitle"')] |
| 35 | public function thenIShouldSeeALoanForUserWithBook(string $userEmail, string $bookTitle): void |
| 36 | { |
| 37 | $body = (string) $this->response->getBody(); |
| 38 | |
| 39 | Assert::that($body)->contains(htmlentities($userEmail)); |
| 40 | Assert::that($body)->contains(htmlentities($bookTitle)); |
| 41 | } |
| 42 | } |