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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:47:44+00:00 2026-05-14T03:47:44+00:00

I have an application with the default directory structure, for an application without custom

  • 0

I have an application with the default directory structure, for an application without custom modules (see structure figure at the end).

I have written a ControllerTestCase.php file as instructed in many tutorials, and I’ve created the appropriate bootstrap file as well (once again, see figures at the end).

I’ve written some model tests which run just fine, but when I started writing the index controller test file, with only one test in it, with only one line in it (“$this->dispatch(‘/’);”), I’m getting the following exception when running phpunit (but navigating with the browser to the same location – all is good and working):

1) IndexControllerTest::test_indexAction_noParams
Zend_Controller_Exception: No default module defined for this application

Why is this ? What have I done wrong ?

Appendixes:
Directory structure:

-proj/
  -application/
    -controllers/
      -IndexController.php
      -ErrorController.php
    -config/
    -layouts/
    -models/
    -views/
      -helpers/
      -scripts/
        -error/
          -error.phtml
        -index/
          -index.phtml
    -Bootstrap.php
  -library/
  -tests/
    -application/
      -controllers/
        -IndexControllerTest.php
      -models/
      -bootstrap.php
      -ControllerTestCase.php
    -library/
    -phpunit.xml
  -public/
    -index.php

(Basically I have some more files in the models directory, but that’s not relevant to this question.)

application.ini file:

[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 = "My"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] = 
phpSettings.date.timezone = "America/Los_Angeles"

[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

tests/application/bootstrap.php file:

<?php 
error_reporting(E_ALL);
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'), // this project' library
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

require_once 'ControllerTestCase.php';

ControllerTestCase.php file:

<?php
require_once ('Zend/Test/PHPUnit/ControllerTestCase.php');
class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase {
    /**
     * 
     * @var Zend_Application
     */
    protected $application;

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

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

    }
}
  • 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-14T03:47:45+00:00Added an answer on May 14, 2026 at 3:47 am

    This is a known bug.
    Here is my workaround to fix this issue:

    <?php
    require_once 'Zend/Application.php';
    require_once 'Zend/Test/PHPUnit/ControllerTestCase.php';
    
    abstract class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase
    {
        protected $_application;
    
        protected 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();
    
            /**
             * Fix for ZF-8193
             * http://framework.zend.com/issues/browse/ZF-8193
             * Zend_Controller_Action->getInvokeArg('bootstrap') doesn't work
             * under the unit testing environment.
             */
            $front = Zend_Controller_Front::getInstance();
            if($front->getParam('bootstrap') === null) {
                $front->setParam('bootstrap', $this->_application->getBootstrap());
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 416k
  • Answers 416k
  • 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 The issue is not within your query. As per comments… May 15, 2026 at 9:21 am
  • Editorial Team
    Editorial Team added an answer I'm not sure about linking back to the code from… May 15, 2026 at 9:21 am
  • Editorial Team
    Editorial Team added an answer It's not often that I say this, but this is… May 15, 2026 at 9:21 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

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.