2011-01-26 30 views
0

Zend框架1.11.2
的PHPUnit 3.5.10
PHP 5.3.1
的NetBeans 6.9.1Zend的應用程序不使用PHPUnit

  1. http://pastebin.com/L5bi9AgY
  2. 測試時完全bootstraped我也跟着Lebensold's tutorial

測試工作,即使有東西像
$this->dispatch('/');
$this->assertResponseCode(200);

,但只要我需要一個控制器類(引擎收錄,#33),以實例化它在設置()方法,我得到一個錯誤說PHPUnit沒有找到父類(Zend_Controller_Action)。所以我的猜測是我在某種程度上錯過了bootstrap,因爲我沒有得到所有的類加載(?)。

另外,當使用「@covers Class :: method」註釋時,我得到相同類型的錯誤。

歡迎任何建議。謝謝。

回答

2

嘗試在您的設置中要求控制器類,例如

class SearchControllerTest extends ControllerTestCase { 

     public function setUp() { 

      parent::setUp(); 

      require_once(APPLICATION_PATH . '/controllers/SearchController.php'); 

     } 
    } 

我記得有類似的問題,它以這種方式工作。

+0

我認爲這樣做。 「謝謝。 – nevvermind 2011-01-26 13:00:50

相關問題