怎么安装PHPUnit

来源:百度知道 编辑:UC知道 时间:2024/05/23 02:11:05
安装程序是PHPUnit唯一支持的安装方法,但你还是可以手工安装。要手工安装,参照以下做法:

1. 从http://pear.php.net/package/PHPUnit2/download下载PHPUnit发布包,然后解压缩,确保目录在php.ini定义的include_path中。

2. 准备phpunit脚本

a. 将pear-phpunit脚本改名为phpunit

b. 将脚本中所有的@php_bin@改名为PHP命令行解释器所在的目录(通常为/usr/bin/ php)。

c. 将此脚本拷贝到一个PATH环境变量所包含的目录中,并将文件属性改为可执行(chmod +x phpunit)。

3. 将PHPUnit2/ Runner/Version.php脚本中的所有@package_version@字符串替换为你所安装的PHPUnit版本(如2.3.0)。

Although using the PEAR Installer is the only supported way to install PHPUnit, you can install PHPUnit manually. For manual installation, do the following:

Download a release archive from http://pear.phpunit.de/get/ and extract it to a directory that is listed in the include_path of your php.ini configuration file.

Prepare th

PHPUnit可以通过PHP扩展和程序库(PEAE)获得。PEAR是可重用PHP组件的框架和分发系统。安装PHPUnit可以通过PEAR安装程序命令获得:

pear install PHPUnit2

根据PEAR的版本命名标准,适用于PHP5的PHPUnit包称为PHPUnit2。PHPUnit是适用于PHP4的包,这在本书后面关于“在PHP4中使用PHPUnit”一章会提到。

安装只有,能够在本地的PEAR目录中找到PHPUnit的源代码,路径通常是/usr/lib/ php/PHPUnit2。

尽管使用PEAR安装程序是PHPUnit唯一支持的安装方法,但你还是可以手工安装。要手工安装,参照以下做法:

1.从http://pear.php.net/package/PHPUnit2/download下载PHPUnit发布包,然后解压缩,确保目录在php.ini定义的include_path中。

2.准备phpunit脚本

a.将pear-phpunit脚本改名为phpunit

b.将脚本中所有的@php_bin@改名为PHP命令行解释器所在的目录(通常为/usr/bin/ php)。

c.将此脚本拷贝到一个PATH环境变量所包含的目录中,并将文件属性改为可执行(chmod +x phpunit)。

3.将PHPUnit2/ Runner/Version.php脚本中的所有@package_version@字符串替换为你所安装的PHPUnit版本(如2.3.0)。