我想调用我的 zend-framework 模型并在其中使用函数,AuthenticationControllerTest.php
但是当我从终端运行它时出现错误。
- -MyZendproject
- -application
-model
-testmodel
- +public
- -tests
- aplication
- controller
- .AuthenticationControllerTest.php
这是我的AuthenticationControllerTest.php
文件
<?php
require_once `PHPUnit/Framework/TestCase.php`;
defined(`APPLICATION_PATH`)
|| define(`APPLICATION_PATH`, realpath(dirname(__FILE__) . `/../application`));
// Define application environment
defined(`APPLICATION_ENV`) || define(`APPLICATION_ENV`, `tests`);
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR,
array(realpath(APPLICATION_PATH . `../../../library`), get_include_path())));
// Zend_Application
require_once `Zend/Application.php`;
$application = new Zend_Application(
APPLICATION_ENV,
realpath(APPLICATION_PATH .`configs/application.ini`)
);
class AuthenticationControllerTest extends PHPUnit_Framework_TestCase
{
public function testLoginRetriespLogin() {
$testmodel = new Model_testmodel_Object();//my model
}
}
但是当从终端“phpunit AuthenticationControllerTest”运行它时,它给了我错误:
$ phpunit AuthenticationControllerTest
..FPHP 致命错误:在第 146 行的 /var/www/versioned/pm160form/tests/application/controllers/AuthenticationControllerTest.php 中找不到类“Model_testmodel_Object”