2010-08-25 76 views
2

我一直在這個瘋了,我發現了一些線程,但沒有一個解決我的問題。Zend Framework,Zend_Test&PHPUnit - Zend_Test_PHPUnit_ControllerTestCase無法找到

我有我的bootstrap.php文件進行測試,它看起來像如果PHPUnit的定義此

define("PHPUNIT", true); 
require_once("/Applications/XAMPP/xamppfiles/htdocs/Common/test/public/index.php"); 

我的index.php文件不應用程序對象調用run()。這是正確的,以阻止應用程序被分派?

我有一個名爲homepage.php的測試文件,它包含一個擴展爲Zend_Test_PHPUnit_ControllerTestCase的類 - 當我運行phpunit時,即使包含絕對路徑的文件,也無法找到該類。

對同一個字符串運行file_exists()返回true。我運行使用--bootstrap標誌的PHPUnit與測試文件homepage.php,低於

require_once("/Applications/XAMPP/xamppfiles/htdocs/libs_php/ZendFramework-1.10.7/library/Zend/Test/PHPUnit/ControllerTestCase.php"); 

class HomepageControllerTest extends Zend_Test_PHPUnit_ControllerTestCase 
{ 
    public function appBootstrap() 
    { 
     $controller = $this->getFrontController(); 

     $controller->registerPlugin(new Default_Controller_Plugin_Initialise()); 
    } 

    public function setUp() 
    { 
     $this->bootstrap = array($this, 'appBootstrap'); 

     parent::setUp();   
    } 

    public function testA() 
    { 
     $this->dispatch('/'); 
     $this->assertController('index'); 
    } 
} 

從PHPUnit的我得到的輸出我的bootstrap.php文件如下,怎麼能類找不到?它看起來不像是一個PHP錯誤,但是來自PHPUnit的東西 - 沒有行號?

PHPUnit 3.3.2 by Sebastian Bergmann. 

Class Zend_Test_PHPUnit_ControllerTestCase could not be found in /Applications/XAMPP/xamppfiles/htdocs/Common/test/tests/library/homepage.php 

感謝您的任何幫助!

+0

我還沒有解決上面的問題,但設法通過遵循這裏的指南http://bit.ly/dvU4LI來獲得PHPUnit的工作。事實證明,如果你想在Zend Framework中做任何事情,不要使用官方文檔? – 2010-08-25 09:32:17

回答

0

我從來沒有以這種方式工作。

我重新開始並且遵循this video - 這非常棒。

相關問題