public function seeFormErrorMessage($key, $expectedErrorMessage = null)
    {
        $viewErrorBag = $this->app['view']->shared('errors');

        if (!($viewErrorBag->has($key))) {
            $this->fail("No form error message for key '$key'\n");
        }

        if (! is_null($expectedErrorMessage)) {
            $this->assertStringContainsString($expectedErrorMessage, $viewErrorBag->first($key));
        }
    }
public function seeFormErrorMessage($key, $expectedErrorMessage = null)
    {
        $viewErrorBag = $this->app['view']->shared('errors');

        if (!($viewErrorBag->has($key))) {
            $this->fail("No form error message for key '$key'\n");
        }

        if (! is_null($expectedErrorMessage)) {
            $this->assertStringContainsString($expectedErrorMessage, $viewErrorBag->first($key));
        }
    }
public function seeFormErrorMessage ( $ key , $ expectedErrorMessage = null ) { $ viewErrorBag = $ this -> app [ 'view' ] -> shared ( 'errors' ) ; if ( ! ( $ viewErrorBag -> has ( $ key ) ) ) { $ this -> fail ( "No form error message for key '$key'\n" ) ; } if ( ! is_null ( $ expectedErrorMessage ) ) { $ this -> assertStringContainsString ( $ expectedErrorMessage , $ viewErrorBag -> first ( $ key ) ) ; } }
Assert that a specific form error message is set in the view.

If you want to assert that there is a form error message for a specific key
but don't care about the actual error message you can omit `$expectedErrorMessage`.

If you do pass `$expectedErrorMessage`, this method checks if the actual error message for a key
contains `$expectedErrorMessage`.

``` php
<?php
$I->seeFormErrorMessage('username');
$I->seeFormErrorMessage('username', 'Invalid Username');
?>
```
@param string $key
@param string|null $expectedErrorMessage
Assert that a specific form error message is set in the view .