linux下安装phpunit简单方法

现在安装phpunit相当简单,只需要下载phar压缩格式的phpunit文件,给个执行权限,就可以执行了

 

以下是一段官方安装文档

wget https://phar.phpunit.de/phpunit.phar

chmod +x phpunit.phar

sudo mv phpunit.phar /usr/local/bin/phpunit

phpunit --version
PHPUnit 4.2.0 by Sebastian Bergmann.

 个人感觉如果不想把phpunit.phar直接放进/usr/local/bin目录下也是可以的

可以执行如下命令,建个符号链接再给个执行的权限就可以了:

ln -s /root/phpunit.phar /usr/local/sbin/phpunit
chmod u+x /usr/local/sbin/phpunit
phpunit --version
PHPUnit 4.2.0 by Sebastian Bergmann.

如果能显示正确的版本号,就表示安装相当成功.

不过目前的Yii框架好像对这种phar格式的phpunit不太支持.

只能下载旧版本的phpunit

官网链接:http://pear.phpunit.de/

下载了几个合并了一下,链接地址:http://pan.baidu.com/s/1i3Jyrel

然后,解压到指定文件夹

 

/path-to-php/PHPUnit-3.7.35

/path-to-php/PHPUnit-3.7.35/phpunit.php /usr/local/sbin/phpunit

chmod u+x phpunit

同时设置php.ini的include_path

include_path = ".:/path-to-php/PHPUnit-3.7.35"

这样就可以调用了!

posted @ 2014-10-15 14:09  yJken的博客  阅读(290)  评论(0编辑  收藏  举报