Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6107397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:11:03+00:00 2026-05-23T14:11:03+00:00

When a user accesses /user/validate without the correct post parameters, my Zend application throws

  • 0

When a user accesses /user/validate without the correct post parameters, my Zend application throws a zend exception. (I get the standard “An Error Occurred” message, framed within my layout). This is intentional.

I am now trying to test that behaviour with PHPUnit. Here’s my test:

/**
 * @expectedException Zend_Exception
 */
public function testEmptyUserValidationParametersCauseException() {
    $this->dispatch('/user/validate');
}

When I run the test I get a message saying it failed, “Expected exception Zend_Exception”. Any ideas?

I have other tests in the file which are working just fine…

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:11:03+00:00Added an answer on May 23, 2026 at 2:11 pm

    The Zend_Controller_Plugin_ErrorHandler plugin handles exceptions for you and the default Error_Controller forces a 500 redirect which may mean the exception you are testing for no longer exists. Try the following unit test and see if it passes:

    public function testUnknownUserRedirectsToErrorPage()
    {
        $this->dispatch('/user/validate');
        $this->assertController('error');
        $this->assertAction('error');
        $this->assertResponseCode('500');
    }
    

    If this works then it shows that by the time you are rendering the error view the exception will no longer exist as it is contained in the code before the redirect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an apache web server, and when a certain user accesses a certain
User equals untrustworthy. Never trust untrustworthy user's input. I get that. However, I am
We would like to use Integrated Windows Authentication if a user accesses our SharePoint
When a user accesses a SharePoint site he is identified by his wndows identity.
I have a table with just one column: userid. When a user accesses a
The code below ensures that when a user accesses control panel, they are ran
When a user accesses my facebook app via http://apps.facebook.com/myappxxxxx , I want it to
I'm writing an ASP.Net MVC application using Jquery to post some data to my
i need to get (somehow) the longitude/latitude of a user once they click on
I'm shifting code from an application built in a non-standard custom PHP framework into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.