PHPUnit自动加载-无此类文件或目录

PHPUnit自动加载-无此类文件或目录,phpunit,Phpunit,安装: pear install --alldeps pear.phpunit.de/PHPUnit 操作后断开卸载 重新安装没有帮助 /usr/share/pear$ pear uninstall phpunit/PHPUnit uninstall ok: channel://pear.phpunit.de/PHPUnit-4.0.9 但是,您仍然可以看到,安装后Autoload.php文件仍然没有出现((( 我不知道如何通过phpunit.phar开始工作,因此尝试通过pear安装,甚至

安装:

pear install --alldeps pear.phpunit.de/PHPUnit
操作后断开卸载 重新安装没有帮助

/usr/share/pear$ pear uninstall phpunit/PHPUnit
uninstall ok: channel://pear.phpunit.de/PHPUnit-4.0.9
但是,您仍然可以看到,安装后Autoload.php文件仍然没有出现(((

我不知道如何通过phpunit.phar开始工作,因此尝试通过pear安装,甚至直接从GitHub开发者那里推翻文件


我很困惑。

您需要修改引导文件以包含自动加载程序和目录

我的样本:

<?php
/**
 * This file is used to configure the basic environment for testing in PHPUnit.
 */

// PHP and Web server settings
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set("America/Toronto");       // Set the default timezone
$_SERVER['SERVER_NAME'] = 'http://myserver';       // Set Web Server name

// Process the Include Path to allow the additional application to be set.
$IncludePaths = explode( PATH_SEPARATOR, get_include_path() );
$NewIncludePaths = array_merge( $IncludePaths, array(dirname(__FILE__) ));
set_include_path( implode( PATH_SEPARATOR, array_unique($NewIncludePaths)));    // Update Include Path
?>

然后,您需要在启动PHPUnit时指定引导文件。

我还发现查找自动加载程序文件有点烦人

矿井位于
/usr/share/php/pear/share/pear/PHPUnit/Autoload.php


所以我更新了我的php.ini文件以包含它。
include_path=“.:/usr/share/php/PEAR:/usr/share/php/PEAR/share/PEAR”
仅运行CLI,而不是从web运行….

这不是一个真正的答案。请添加一些内容来改进它。
<?php
/**
 * This file is used to configure the basic environment for testing in PHPUnit.
 */

// PHP and Web server settings
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set("America/Toronto");       // Set the default timezone
$_SERVER['SERVER_NAME'] = 'http://myserver';       // Set Web Server name

// Process the Include Path to allow the additional application to be set.
$IncludePaths = explode( PATH_SEPARATOR, get_include_path() );
$NewIncludePaths = array_merge( $IncludePaths, array(dirname(__FILE__) ));
set_include_path( implode( PATH_SEPARATOR, array_unique($NewIncludePaths)));    // Update Include Path
?>