PHPUnit:php单元测试
通过php的pear进行安装即可
该方式在windows及linux下都可以使用
先安装或者更新pear:
linux默认安装pear的
安装:
Go-pear.phar下载地址:http://pear.php.net/go-pear.phar
更新:
pear clear-cache pear upgrade pear pear upgrade-all
PHPUnit
官方安装:
wget https://phar.phpunit.de/phpunit.phar chmod +x phpunit.phar mv phpunit.phar /usr/local/bin/phpunit phpunit --version
pear安装:
方法1:
pear config-set auto_discover 1 pear install pear.phpunit.de/PHPUnit pear install pear.phpunit.de/DbUnit
安装扩展:
pear install pear.phpunit.de/PHPUnit_Story pear install pear.phpunit.de/PHPUnit_Selenium
方法2:
pear channel-discover pear.phpunit.de pear channel-discover components.ez.no pear channel-discover pear.symfony-project.com pear channel-discover pear.symfony.com pear install -a -f phpunit/PHPUnit
安装扩展:
pear install phpunit/DbUnit pear install phpunit/PHPUnit_Sotry pear install phpunit/PHPUnit_Selenium
使用:
% phpunit functional/PostTest.php // 执行单个测 试 % phpunit --verbose functional // 执行 'functional' 下的所有测 试 % phpunit --coverage-html ./report unit