我正在尝试使用ZF 1.12上的PHPUnit(3.7)测试我的服务 当我测试一个调用DAO的服务时,找不到DAO。 我尝试过很多东西,但总是出错:
bootstrap.php中
define('TESTS_PATH', realpath(dirname(__FILE__)));
define('APPLICATION_LIBRARY_PATH', TESTS_PATH . '/../../php-deps');
define('APPLICATION_PATH', TESTS_PATH . '/../application');
define('LIBRARY_PATH', APPLICATION_PATH . '/../library');
define('APPLICATION_ENV', 'testing');
$_SERVER['SERVER_NAME'] = 'http://link.local';
$includePaths = array( APPLICATION_PATH,
LIBRARY_PATH,
APPLICATION_LIBRARY_PATH,
TESTS_PATH,
get_include_path(),
);
set_include_path(implode(PATH_SEPARATOR, $includePaths));
require_once 'Zend/Loader/Autoloader.php';
require_once 'model/Service/Abstract.php';
Zend_Loader_Autoloader::getInstance()->registerNamespace('Application');
Zend_Session::$_unitTestEnabled = true;
Zend_Session::start();
我的文件
├───model
│ ├───Common
│ ├───Dao
│ ├───Entity
│ │ ├───Abstract
│ │ └───Interface
│ └───Service
│ ├───Administration
│ ├───Dev
│ ├───Exception
├───test
│ └───application
│ ├───library
│ │ └───Classes
│ └───model
│ └───Service
│ ├───Administration
│ ├───Collaborators
│ ├───Mission
│ └───Planning
欢迎任何想法!