diff --git a/src/Codeception/Module/Symfony.php b/src/Codeception/Module/Symfony.php index b2c6af65..b7c3452d 100644 --- a/src/Codeception/Module/Symfony.php +++ b/src/Codeception/Module/Symfony.php @@ -1170,6 +1170,27 @@ public function amLoggedInAs(UserInterface $user, string $firewallName = 'main', $this->client->getCookieJar()->set($cookie); } + /** + * Verifies that there are one or more errors bound to the submitted form. + * + * ``` php + * seeFormHasErrors(); + * ``` + * + * @return void + */ + public function seeFormHasErrors() + { + $formCollector = $this->grabCollector('form', __FUNCTION__); + + $this->assertGreaterThan( + 0, + $formCollector->getData()->offsetGet('nb_errors'), + 'Expecting that the form has errors, but there were none!' + ); + } + /** * Grab a Doctrine entity repository. * Works with objects, entities, repositories, and repository interfaces.