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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:58:06+00:00 2026-05-15T23:58:06+00:00

I have read many posts about setting up unit testing in Zend Framework and

  • 0

I have read many posts about setting up unit testing in Zend Framework and I simply have not been able to get even one simple unit test to run. The issue is with setting up and testing the bootstrap environment. I tried the simplest of ways using the ZFW docs, but I always get this error:

Zend_Config_Exception: parse_ini_file(/usr/local/zend/apache2/htdocs/APPBASE/tests/application.ini[function.parse-ini-file]: failed to open stream: No such file or directory

Here is phpunit.xml:

<phpunit bootstrap="./application/bootstrap.php" colors="true">
    <testsuite name="ApplicationTestSuite">
        <directory>./application/</directory>
        <directory>./library/</directory>
    </testsuite>
    <filter>
        <whitelist>
            <directory suffix=".php">../application</directory>
            <directory suffix=".php">../application/library</directory>
            <exclude>
                <directory suffix=".phtml">../application/views</directory>
                <file>../application/Bootstrap.php</file>
            </exclude>
       </whitelist>
    </filter>
    <logging>
        <log type="coverage-html" target="./log/coverage" charset="UTF-8"
         yui="false" highlight="false" lowUpperBound="35" highLowerBound="70"/>
    </logging>
</phpunit>

Here is my bootstrap (tests/application/bootstrap.php):

<?php
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ?   getenv('APPLICATION_ENV') : 'development'));

set_include_path(implode(PATH_SEPARATOR, array(
   realpath(APPLICATION_PATH . '/library'),
    get_include_path(),
)));

?>

The controller I am trying to test (tests/application/controllers/AuthControllerTest.php):

<?php
require_once 'ControllerTestCase.php';
/**
 * AuthController test case.
 */
class AuthControllerTest extends ControllerTestCase
{
    /**
     * @var AuthController
     */
    private $AuthController;
    /**
     * Prepares the environment before running a test.
     */
    public function setUp ()
    {
        parent::setUp();
        // TODO Auto-generated AuthControllerTest::setUp()
        $this->AuthController = new AuthController(/* parameters */);
    }
    /**
     * Cleans up the environment after running a test.
     */
    public function tearDown ()
    {
        // TODO Auto-generated AuthControllerTest::tearDown()
        $this->AuthController = null;
        parent::tearDown();
    }


    public function testCallWithoutActionShouldRedirectToLoginAction()
    {
        $this->dispatch('/auth');
        $this->assertController('auth');
        $this->assertAction('login');
    }
}

and ControllerTestCase.php (in /test/application/controllers):

<?php
require_once 'Zend/Application.php';
require_once 'Zend/Test/PHPUnit/ControllerTestCase.php';

abstract class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase
{
 public $application;

 public function setUp()
 {
  $this->bootstrap = array($this, 'appBootStrap');
  parent::setUp();
 }

    public function appBootstrap()
    {
       $this->application = new Zend_Application(
                                  APPLICATION_ENV,
                                  APPLICATION_PATH . '/configs/application.ini'
                                  );

      $this->application->bootstrap();
    }

 public function tearDown()
 {
  Zend_Controller_Front::getInstance()->resetInstance();
  $this->resetRequest();
  $this->resetResponse();
  $this->request->setPost(array());
  $this->request->setQuery(array());
 }

}

my application.ini (APPBASE/configs/application.ini):

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] = ""
resources.view.doctype = "XHTML1_STRICT"
phpSettings.date.timezone = 'America/Chicago';

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

Note that the path in the error message does not line up with the path specified in my bootstrap. I thought at one point that the line “$this->application->bootstrap();” might be executing my regular app’s bootstrap and changing the app path so I commented it out, but I have the same error regardless. If I “Run as PHP Unit Test” inside Zend Studio with this commented out, I get the original Zend Config Exception. If I run phpunit from the commandline, it can’t find any of the controllers in my app. When I uncomment and run from the commandline, I get the Zend Config Exception. Running in Zend Studio always results in the Zend Config exception.

Can anyone offer some insight as to why I cannot get the application path set correctly?

  • 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-15T23:58:06+00:00Added an answer on May 15, 2026 at 11:58 pm

    You just have some of the paths wrong I think.

    Based on the way you have your phpunit.xml I’d move the bootstap file up one dir to tests/

    Then change the first path on line 1 in phpunit.xml to ./bootstrap.php

    Then change the path for APPLICATION_PATH in bootstrap to /../application

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

Sidebar

Ask A Question

Stats

  • Questions 542k
  • Answers 542k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use: SELECT p.id as a, p.url as b, t.id as… May 17, 2026 at 3:22 am
  • Editorial Team
    Editorial Team added an answer There are two parts to the problem First Issue You… May 17, 2026 at 3:19 am
  • Editorial Team
    Editorial Team added an answer I thought I'd show the regex approach, too. It doesn't… May 17, 2026 at 3:18 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Alright...I've given the site a fair search and have read over many posts about
I have read some posts about this topic and the answers are comet, reverse
I have read many posts on this topic; among them and most recently .NET
OK I have read many posts regarding Dual Licensing using MIT and GPL licenses.
I have read about partial methods in the latest C# language specification , so
I have read this post about how to test private methods. I usually do
I have read through several reviews on Amazon and some books seem outdated. I
I have read a lot that LISP can redefine syntax on the fly, presumably
I have read that using database keys in a URL is a bad thing
I have read on Stack Overflow some people that have converting to C#2.0 to

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.