Here is what I did to make it work:
First, we need to solve the startup problem. We will do this by creating a file in which all tests will be included, and place it in the test directory. Note. I almost completely copied all of this from my /public/index.php.
# /tests/loader.php <?php define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application/')); set_include_path( APPLICATION_PATH . '/../library' . PATH_SEPARATOR . APPLICATION_PATH . '/models' . PATH_SEPARATOR . APPLICATION_PATH . '/forms' . PATH_SEPARATOR . get_include_path() ); require_once "Zend/Loader.php"; Zend_Loader::registerAutoload();
Secondly, we need to include this file in our test. Our test file is located in / tests / application / controller /. I will not use my boot file as a plugin, since my boot file works the same as the QuickStart Tutorial , I will just contact it by setting the location as the public $ bootstrap. When Zend_Test_PHPUnit_ControllerTestCase constructed, it will look for the boot file that we installed here.
<?php require_once '../../loader.php'; class IndexControllerTest extends Zend_Test_PHPUnit_ControllerTestCase { public $bootstrap = '../../../application/bootstrap.php'; public function testIndexAction() { $this->dispatch('/index'); $this->assertController('index'); $this->assertAction('index'); } }
And this! If my boot file was already a plugin, it might be a little more complicated, but since it is not, it is very simple.
source share