File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,6 @@ protected function uriMessage(string $onPage = ''): string
8282 if (!$ this ->uri ) {
8383 return '' ;
8484 }
85- return " {$ onPage } {$ this ->uri }" ;
85+ return "{$ onPage } {$ this ->uri }" ;
8686 }
8787}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Tests \Codeception \Constraint ;
4+
5+ use Codeception \Constraint \Page ;
6+ use PHPUnit \Framework \AssertionFailedError ;
7+ use PHPUnit \Framework \TestCase ;
8+
9+ class PageTest extends TestCase
10+ {
11+ public function testPassesIfPageContainsString (): void
12+ {
13+ $ constraint = new Page ('text ' , 'uri ' );
14+ $ this ->assertNull ($ constraint ->evaluate ('long text string ' ));
15+ }
16+
17+ public function testFailsIfPageDoesntContainString (): void
18+ {
19+ $ this ->expectException (AssertionFailedError::class);
20+ $ this ->expectExceptionMessage (<<<EOT
21+ Failed asserting that on page uri
22+ --> other string
23+ --> contains "text".
24+ EOT
25+ );
26+
27+ $ constraint = new Page ('text ' , 'uri ' );
28+ $ this ->assertNull ($ constraint ->evaluate ('other string ' ));
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments