PHPUnit安装

来源:互联网 发布:淘宝卖家怎么联系淘客 编辑:程序博客网 时间:2024/06/06 03:28

步骤:
  1. 安装 pear ,参见http://www.cnblogs.com/heiing/archive/2011/12/07/2279405.html
  1. 安装 PHPUnit,参见http://www.phpunit.de/manual/3.7/en/installation.html



步骤:

  1. 到 http://windows.php.net/downloads/releases/archives/ 下载PHP,解压并重命名到为php5.x.x,进入php5.x.x目录
  2. 如果需要扩展,打开php.ini,设置 extension_dir = "ext" , 取消对应扩展的注释,并将PHP路径添加到path环境变量中。
  3. 打开cmd,进入php5.x.x目录,运行go-pear.bat
  4. 如果找不到go-pear.bat文件1、下载: http://pear.php.net/go-pear.phar 2、命令行下,在php目录下运行php go-pear.pharPS:如果该命令报错,可能是没有将PHP路径添加到path环境变量中。可能是因为我没有安装PHP的IDE,所以一直没有配置它,偶然之间才想到可能要添加这个环境变量。
  5. 提示
    Are you installing a system-wide PEAR or a local copy?(system|local) [system]

    按回车确定

  6. 提示
    复制代码
     1. Installation base ($prefix)                   : D:\path_to_your_php\php5.x.x2. Temporary directory for processing            : D:\path_to_your_php\php5.x.x\tmp 3. Temporary directory for downloads             : D:\path_to_your_php\php5.x.x\tmp 4. Binaries directory                            : D:\path_to_your_php\php5.x.x5. PHP code directory ($php_dir)                 : D:\path_to_your_php\php5.x.x\pear 6. Documentation directory                       : D:\path_to_your_php\php5.x.x\docs 7. Data directory                                : D:\path_to_your_php\php5.x.x\data 8. User-modifiable configuration files directory : D:\path_to_your_php\php5.x.x\cfg 9. Public Web Files directory                    : D:\path_to_your_php\php5.x.x\www10. Tests directory                               : D:\path_to_your_php\php5.x.x\tests11. Name of configuration file                    : D:\path_to_your_php\php5.x.x\pear.ini12. Path to CLI php.exe                           : D:\path_to_your_php\php5.x.x1-12, ‘all’ or Enter to continue:
    复制代码

    确定无误,则按回车,输入数字则修改对应项。修改后,按回车进行安装。

  7. 生成环境变量PEAR_ENV.reg文件,双击导入注册表
  8. 此时,输入pear -V 查看版本信息,输入pear list 查看已安装的包
  9. 如果pear list查看没有 Image_GraphViz 包和 Log 包,则使用 pear install Log 安装Log,使用 pear install Image_GraphViz
  10. 安装 Image_GraphViz 时,如果提示不能包含Structures/Graph/Node.php,则
    1. 尝试set查看PHP_PEAR_*相关环境变量是否正确
    2. 尝试关闭cmd窗口,再打开,再pear install Image_GraphViz
    3. 尝试pear install Stuctures_Graph,再pear install Image_GraphViz
  11. 至此,pear list 应有
    复制代码
    INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:=========================================PACKAGE          VERSION STATEArchive_Tar      1.3.3   stableConsole_Getopt   1.2.3   stableImage_GraphViz   1.3.0   stableLog              1.12.7  stablePEAR             1.9.0   stableStructures_Graph 1.0.2   stableXML_Util         1.2.1   stable  
    复制代码

此时,使用 pear upgrade-all 即可升级所有的包。

按快捷键 Win + R ,输入cmd并回车。进入存放phpunit.phar的路径。输入 echo @php "%~dp0phpunit.phar" %* > phpunit.cmd 并回车。接着输入 phpunit --version 并回车。如果得到输出 PHPUnit x.y.z by Sebastian Bergmann and contributors. 则表示配置好了(如果有误,输入exit 并回车,重新来一遍)。

将PHPunit的路径添加到path路径变量中。


0 0
原创粉丝点击