Loving Coding & Visual Design

Yii PHPUnit

在yii protected/tests/目录下运行:phpunit unit进行单元测试,出现各种错误:
比如pear install phpunit/DbUnit或者PHP_Invoker找不到,这个需要PHP支持pcntl模块,windows下不支持。

如果出现如下错误:
PHPUnit_Extensions_Story_TestCase.php failed to open yiiframeworkYiiBase.php
可以尝试安装:
pear install phpunit/PHPUnit_Story
注意:phpunit的pear库已经移到phpunit.de,并且在2014年底,安装方式会有变化。

You have installed PHPUnit via PEAR. This installation method is no longer
supported and http://pear.phpunit.de/ will be shut down no later than
December, 31 2014.

一般常见找不到问题,可以通过下面来安装,找不到可以pear search试试。

pear install phpunit/PHPUnit
pear install phpunit/PHPUnit_Selenium
pear install phpunit/PHP_Invoker
pear install phpunit/PHPUnit_Story
pear install phpunit/DbUnit

具体测试过程中,Yii include的错误,可以直接注释,或者disable掉

//////////////// yiiframeworktestCTestCase.php
//require_once('PHPUnit/Runner/Version.php');
//require_once('PHPUnit/Util/Filesystem.php'); // workaround for PHPUnit <= 3.6.11

spl_autoload_unregister(array('YiiBase','autoload'));
//require_once('PHPUnit/Autoload.php');
spl_autoload_register(array('YiiBase','autoload')); // put yii's autoloader at the end
////////////////

Failed opening PHPUnit_Extensions_Story_TestCase.php yiiframeworkYiiBase.php
disable include path:
YiiBase::$enableIncludePath=false;



下一页


最 近 文 章

  1. Virtualbox安装window10的64位预览版错误 - Fri, 26 Dec 2014 04:47:24 +0000
  2. Grunt Build Error: require.js blocks are no more supported - Mon, 22 Dec 2014 06:00:16 +0000
  3. Mysql5.7 start mysqld.service失败的问题 - Wed, 17 Dec 2014 17:30:17 +0000
  4. PHP5.4.35的php_curl.dll问题 - Tue, 16 Dec 2014 15:11:43 +0000
  5. Mysql错误:mysql Illegal mix of collations for operation like - Wed, 05 Nov 2014 01:10:16 +0000
  6. 论程序员的幸福感 - Wed, 08 Oct 2014 11:18:30 +0000
  7. $.parseJSON Unexpected token t错误 - Fri, 12 Sep 2014 03:53:26 +0000
  8. ImageMagic把pdf转成jpg出现黑色块的问题 - Thu, 28 Aug 2014 11:27:36 +0000
  9. 现代浏览器工作原理 - Thu, 28 Aug 2014 09:34:21 +0000
  10. 前端打包压缩合并工具Fis - Mon, 18 Aug 2014 14:44:19 +0000