PHPUnit安装

步骤:
  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\www
    10. Tests directory                               : D:\path_to_your_php\php5.x.x\tests
    11. Name of configuration file                    : D:\path_to_your_php\php5.x.x\pear.ini
    12. Path to CLI php.exe                           : D:\path_to_your_php\php5.x.x
    1-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 STATE
    Archive_Tar      1.3.3   stable
    Console_Getopt   1.2.3   stable
    Image_GraphViz   1.3.0   stable
    Log              1.12.7  stable
    PEAR             1.9.0   stable
    Structures_Graph 1.0.2   stable
    XML_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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值