Helper function: assert that the error message is found.
function assertErrorMessage(array $error) {
$message = t('%type: !message in %function (line ', $error);
$this
->assertRaw($message, format_string('Found error message: !message.', array(
'!message' => $message,
)));
}