当前位置: 代码迷 >> PHP >> phpunit 装配
  详细解决方案

phpunit 装配

热度:57   发布时间:2016-04-28 17:35:44.0
phpunit 安装
详细的安装步骤看官方文档,这里主要介绍遇到的问题。
为了生成分析报告:安装了 xdebug
wget http://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit/
查看是否安装成功
/php5/bin/php phpunit.phar --version
这里操作时报错了。说没有 gmp.soa 文件。
我建了个软链接文件 gmp.soa => gmp.so
解决掉。
这里显示:
PHPUnit 4.6.4 by Sebastian Bergmann and contributors.
表示安装成功了。
下面写个测试示例:
====================
# cat DependencyFailureTest.php 
<?phpclass DependencyFailureTest extends PHPUnit_Framework_TestCase {  public function testOne() {    $this->markTestIncomplete("this is don't done test.");  }  public function testTwo() {  }}


====================
执行代码
/php5/bin/php phpunit.phar /tmp/DependencyFailureTest
PHPUnit 4.6.4 by Sebastian Bergmann and contributors.
I.
Time: 1.15 seconds, Memory: 22.75Mb
OK, but incomplete, skipped, or risky tests!
Tests: 2, Assertions: 0, Incomplete: 1.
#
注意执行时的文件路径不可以有下划线。