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

  • Home
  • SEARCH
  • 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 3611550
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:53:22+00:00 2026-05-18T21:53:22+00:00

I am running some unit test on my Zend Framework application. What I cant

  • 0

I am running some unit test on my Zend Framework application. What I cant understand is that the following test fails:

public function testCreateFaqItem()
{
    $this->LoginUser();
    $this->dispatch('/faq/admin-faq/create');
    var_dump($this->getResponse());
    $this->assertResponseCode(200);
    $this->assertQueryContentContains('h1', 'Create');
    $this->assertController('admin-faq');
    $this->assertAction('edit');
}

it fails if on assertResponseCode(200), when i remove the assertResponseCode(200), the test passes. Any help will be much appreciated.

— EDIT —

Response object dump :

object(Zend_Controller_Response_HttpTestCase)#1130 (8) {
  ["_body":protected]=>
  array(1) {
    ["default"]=>
    string(0) ""
  }
  ["_exceptions":protected]=>
  array(0) {
  }
  ["_headers":protected]=>
  array(1) {
    [0]=>
    array(3) {
      ["name"]=>
      string(8) "Location"
      ["value"]=>
      string(13) "/user/profile"
      ["replace"]=>
      bool(true)
    }
  }
  ["_headersRaw":protected]=>
  array(0) {
  }
  ["_httpResponseCode":protected]=>
  int(302)
  ["_isRedirect":protected]=>
  bool(true)
  ["_renderExceptions":protected]=>
  bool(false)
  ["headersSentThrowsException"]=>
  bool(true)
}

Thanks

  • 1 1 Answer
  • 2 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-18T21:53:23+00:00Added an answer on May 18, 2026 at 9:53 pm

    To fix the problem of logging in the user and still testing for the response code 200, i inserted $this->resetResponse(); after logging in the user.

    public function testCreateFaqItem()
        {
            $this->LoginUser();
            $this->resetResponse();
            $this->dispatch('/faq/admin-faq/create');
            $this->assertResponseCode(200);
            $this->assertQueryContentContains('h1', 'Create');
            $this->assertController('admin-faq');
            $this->assertAction('create');
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running some unit test that persist documents into the MongoDb database. For
Im using the Prism/Composite Application Library and trying to unit test some code that
Quick JUnit question. I'm running some unit tests that involve starting up the GUI
I'm attempting to unit test some code using NUnit. I have a method: public
Just some days ago I started looking into a unit test framework called check,
I am getting this error when running some unit tests (using the Test::Unit module
I've made some unit tests (in test class). The tutorial I've read said that
I have some unit tests set up in my PowerBuilder application that run through
I have a long-running unit test job in hudson. If some tests fail I
We have some unit tests running against a SQL server 2000 database using the

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.