diff --git a/tests/classes/PhraseanetWebTestCaseAuthenticatedAbstract.php b/tests/classes/PhraseanetWebTestCaseAuthenticatedAbstract.php index 42b92b0e7d..8f4bc8585d 100644 --- a/tests/classes/PhraseanetWebTestCaseAuthenticatedAbstract.php +++ b/tests/classes/PhraseanetWebTestCaseAuthenticatedAbstract.php @@ -1,8 +1,8 @@ execute(); $stmt->closeCursor(); } + + protected function assertFlashMessage(Crawler $crawler, $flashType, $quantity, $message = null, $offset = 0) + { + if (!preg_match('/[a-zA-Z]+/', $flashType)) { + $this->fail(sprintf('FlashType must be in the form of [a-zA-Z]+, %s given', $flashType)); + } + + $this->assertEquals($quantity, $crawler->filter('.alert.alert-'.$flashType)->count()); + + if (null !== $message) { + $this->assertEquals($message, $crawler->filter('.alert.alert-'.$flashType.' .alert-block-content')->eq($offset)->text()); + } + } + + protected function assertFlashMessagePopulated(Application $app, $flashType, $quantity) + { + if (!preg_match('/[a-zA-Z]+/', $flashType)) { + $this->fail(sprintf('FlashType must be in the form of [a-zA-Z]+, %s given', $flashType)); + } + + $this->assertEquals($quantity, count($app['session']->getFlashBag()->get($flashType))); + } }