Skip to content

Commit 354f62a

Browse files
authored
Added seeFormHasErrors function (#48)
1 parent a80d38d commit 354f62a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,27 @@ public function amLoggedInAs(UserInterface $user, string $firewallName = 'main',
11571157
$this->client->getCookieJar()->set($cookie);
11581158
}
11591159

1160+
/**
1161+
* Verifies that there are one or more errors bound to the submitted form.
1162+
*
1163+
* ``` php
1164+
* <?php
1165+
* $I->seeFormHasErrors();
1166+
* ```
1167+
*
1168+
* @return void
1169+
*/
1170+
public function seeFormHasErrors()
1171+
{
1172+
$formCollector = $this->grabCollector('form', __FUNCTION__);
1173+
1174+
$this->assertGreaterThan(
1175+
0,
1176+
$formCollector->getData()->offsetGet('nb_errors'),
1177+
'Expecting that the form has errors, but there were none!'
1178+
);
1179+
}
1180+
11601181
/**
11611182
* Grab a Doctrine entity repository.
11621183
* Works with objects, entities, repositories, and repository interfaces.

0 commit comments

Comments
 (0)