public function assertMessage($negate, $type, $message, $args = [])
    {
        $type = trim($type);
        $negate = (bool) $negate;
        $elements = $this->getMessagesContainers($type);

        if (empty($elements) && !$negate) {
            throw new \UnexpectedValueException(sprintf("No $type messages on the page (%s).", self::$pageUrl));
        }

        if ($args instanceof TableNode) {
            $args = $args->getRowsHash();
        }

        $translated = t($message, $args);

        self::debug([
            'Input: %s',
            'Translated: %s',
        ], [
            $message,
            $translated,
        ]);

        /** @var NodeElement $element */
        foreach ($elements as $element) {
            $text = trim($element->getText());
            $result = strpos($text, $message) !== false || strpos($text, $translated) !== false;

            if ($negate ? $result : !$result) {
                throw new \RuntimeException(sprintf(
                    "The $type message %s found on the page (%s).",
                    $negate ? 'not' : '',
                    self::$pageUrl
                ));
            }
        }
    }
public function assertMessage($negate, $type, $message, $args = [])
    {
        $type = trim($type);
        $negate = (bool) $negate;
        $elements = $this->getMessagesContainers($type);

        if (empty($elements) && !$negate) {
            throw new \UnexpectedValueException(sprintf("No $type messages on the page (%s).", self::$pageUrl));
        }

        if ($args instanceof TableNode) {
            $args = $args->getRowsHash();
        }

        $translated = t($message, $args);

        self::debug([
            'Input: %s',
            'Translated: %s',
        ], [
            $message,
            $translated,
        ]);

        /** @var NodeElement $element */
        foreach ($elements as $element) {
            $text = trim($element->getText());
            $result = strpos($text, $message) !== false || strpos($text, $translated) !== false;

            if ($negate ? $result : !$result) {
                throw new \RuntimeException(sprintf(
                    "The $type message %s found on the page (%s).",
                    $negate ? 'not' : '',
                    self::$pageUrl
                ));
            }
        }
    }
@example
I should see the message "Hello, user."
I should see the error message "An error occured."
I should not see the success message "Everything fine."
I should not see the error message "!name field is required."
| !name | E-mail address  |

@param string $negate
Indicates that user should or should not see message on the page.
@param string $type
Message type: error, warning, success. Could be empty.
@param string $message
Message to found. Placeholders allowed.
@param TableNode|array $args
Placeholders conformity.

@Then /^(?:|I )should(| not) see the (.* )message "([^"]*)"$/