Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
LoanMyLoansContext
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 thenIShouldSeeATableWithRows
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 thenIShouldSee
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 thenIShouldNotSee
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
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
8declare(strict_types=1);
9
10namespace Tests\AppDemo\Acceptance;
11
12use Assert\Assert;
13use Behat\Step\Then;
14use Exception;
15use Nyholm\Psr7\Response;
16use Tests\AppDemo\Acceptance\Trait\BrowsePageTrait;
17
18final class LoanMyLoansContext extends BehatContext
19{
20    use BrowsePageTrait;
21
22    private Response $response;
23
24    private ?Exception $exception = null;
25
26    #[Then('I should see a table with :count row(s)')]
27    public function thenIShouldSeeATableWithRows(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 :text')]
35    public function thenIShouldSee(string $text): void
36    {
37        $body = (string) $this->response->getBody();
38
39        Assert::that($body)->contains(htmlentities($text));
40    }
41
42    #[Then('I should not see :text')]
43    public function thenIShouldNotSee(string $text): void
44    {
45        $body = (string) $this->response->getBody();
46
47        Assert::that($body)->notContains(htmlentities($text));
48    }
49}