class ControllerTest extends Zend_Test_PHPUnit_ControllerTestCase { public $object; public function setUp() { $this->bootstrap = array($this, 'boostrap'); parent::setUp(); } public function bootstrap(){ $this->application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $this->application->bootstrap(); } public function testIndexAction(){ // body } }
這是測試的類。我的問題是如何實現testIndexAction其中在命令提示符實際的命令是:PHPUnit配置測試
PHP zfrun.php -a ..index
'zfrun.php'從哪裏來?你可以鏈接到它的來源或發佈它,如果它很短? Zend的ControllerTestCase被設計爲給定一個派發路徑,渲染視圖並對結果內容作出斷言。 – 2011-05-04 06:48:59
zfrun.php來自測試,它也是應用程序的根。 zfrun.php就像一個引導文件。用於應用程序Bootstrap.php的實際引導程序還會實例化Zend_Console_Getopt,它也定義運行該應用程序的參數。 – Efox 2011-05-04 07:29:37