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 7653819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:07:12+00:00 2026-05-31T12:07:12+00:00

I am using PHPUnit 3.5 and CIUnit with PHING 2.4 for unit testing my

  • 0

I am using PHPUnit 3.5 and CIUnit with PHING 2.4 for unit testing my CodeIgniter controller functions

The problem is when the function i tested contains a redirect() function, the testcase will stop and will not continue the execution. There is also no available error log for this.

What could be the problem for this? Do i have to download/update PHPUnit specific library?

Any suggestion would be greatly appreciated.

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-31T12:07:13+00:00Added an answer on May 31, 2026 at 12:07 pm

    Well this would be because the redirect() fn exits after doing a redirect (which is what you should be doing when you do a redirect to stop further code execution while waiting on the browser redirect).

    /system/helpers/url_helper.php:

    /**
     * Header Redirect
     *
     * Header redirect in two flavors
     * For very fine grained control over headers, you could use the Output
     * Library's set_header() function.
     *
     * @access  public
     * @param   string  the URL
     * @param   string  the method: location or redirect
     * @return  string
     */
    if ( ! function_exists('redirect'))
    {
        function redirect($uri = '', $method = 'location', $http_response_code = 302)
        {
            if ( ! preg_match('#^https?://#i', $uri))
            {
                $uri = site_url($uri);
            }
    
            switch($method)
            {
                case 'refresh'  : header("Refresh:0;url=".$uri);
                    break;
                default         : header("Location: ".$uri, TRUE, $http_response_code);
                    break;
            }
            exit;  <===<<< here is the exit
        }
    }
    

    The only way ‘around’ this is to eliminate the exit; after the redirect call.

    Ref: http://codeigniter.com/user_guide/helpers/url_helper.html

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

Sidebar

Related Questions

Am using PHPUnit for unit testing my functions when ever any warning comes in
Hey everyone, I've been using PHPUnit to to do unit testing on a Symfony/Doctrine
When i am trying to make unit testing the each file using PHPUnit tool
I'm currently using Zend Framework in conjunction with PHPUnit to conduct unit testing on
I using PHPUnit and Selenium Server to testing Yii Application, but whenever i tried
Having a weird problem with PHPUnit. We're using PHPUnit as part of a continuous
I'm new on testing, I'm using PHPUnit to write test. All the site has
I'm testing a Zend Framework application using PHPUnit and Jenkins. I need to override
I am creating a custom testing application using PHPUnit and Goutte. I would like
I am testing a Zend application using PHPUnit. From time to time, I want

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.