我一直在这个疯了,我发现了一些线程,但没有一个解决我的问题。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
感谢您的任何帮助!
我还没有解决上面的问题,但设法通过遵循这里的指南http://bit.ly/dvU4LI来获得PHPUnit的工作。事实证明,如果你想在Zend Framework中做任何事情,不要使用官方文档? – 2010-08-25 09:32:17