ZF-8912: ControllerTestCase failure messages are lacking to identify failure


Lots of failures can happen inside the MVC, however the failure messages of the assertions suck to identify the root cause in this regard. They should all grab the ErrorHandler ACtion plugin if present and check if there is an exception on the stack and print it aswell.


Some example, should probably be factored out into its own "annotateErrorMessageFromErrorHandler" method:

    public function assertController($controller, $message = '')
        if ($controller != $this->request->getControllerName()) {
            $msg = sprintf('Failed asserting last controller used <"%s"> was "%s"',
            $errors = $this->getRequest()->getParam('error_handler');
            if ($errors) {
                if ($errors->exception instanceof Exception) {
                    $msg .= "\nException was catched in Front-Controller:\n[".get_class($errors->exception)."] ".$errors->exception->getMessage()."\n";
                    $msg .= "Stack Trace: ".$errors->exception->getTraceAsString()."\n\n";

            if (!empty($message)) {
                $msg = $message . "\n" . $msg;