Beim Ausführen von Controller-Unit-Tests in zend framework wird die Ausnahme "Für diese Anwendung ist kein Standardmodul definiert" angezeigt

Ich habe eine Anwendung mit der Standardverzeichnisstruktur für eine Anwendung ohne benutzerdefinierte Module (siehe Strukturabbildung am Ende).

Ich habe eine ControllerTestCase.php-Datei geschrieben, wie in vielen Tutorials beschrieben, und ich habe auch die entsprechende Bootstrap-Datei erstellt (siehe auch hier die Abbildungen am Ende).

Ich habe einige Modelltests geschrieben, die einwandfrei funktionieren, aber als ich anfing, die Testdatei für den Indexcontroller mit nur einem Test und nur einer Zeile zu schreiben ("$ this-> dispatch ('/');" ), Ich bekomme die folgende Ausnahme, wenn ich phpunit starte (aber mit dem Browser zum selben Ort navigiere - alles ist gut und funktioniert):

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

Warum ist das ? Was habe ich falsch gemacht ?

Anhänge:
Verzeichnisaufbau:

-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

(Grundsätzlich habe ich noch einige Dateien im Models-Verzeichnis, aber das ist für diese Frage nicht relevant.)

application.ini Datei:

[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

Datei tests / application / bootstrap.php:

<?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-Datei:

<?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');

    }
}

Antworten auf die Frage(2)

Ihre Antwort auf die Frage