douwei1904 2014-07-10 17:50
浏览 75
已采纳

使用类PHPUnit_Util_Filesystem的PHPUnit for CodeIgniter错误

Been trying to get PHPUnit together with CIUnit in order to get tests done with codeigniter but get this error when trying to point to my phpunit install.

PHPUnit is installed here, path is set on profile:

/home/web/phpunit/PHPUnit/

on the tests directory of codeigniter

/home/web/web.com/codeigniter/tests

$ phpunit


Fatal error: Class 'PHPUnit_Util_Filesystem' not found in /home/web/phpunit/PHPUnit/Autoload.php on line 209

offending line:

if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('PHP/Invoker/Autoload.php')) {
require_once 'PHP/Invoker/Autoload.php';
}

The directory of PHPUnit folder does not have a Util folder but i manually added it and inside it has a Filesystem.php but not sure why its not accessing correctly even after adding it manually. Any help is appreciated.

UPDATE: was able to use PHPUnit using the phar file. Now I get a similar error but was able to run other tests on the phpunit-master directory.

I get now this error:

Fatal error: Call to undefined method PHPUnit_Util_Filesystem::fileExistsInIncludePath() in /home/web/web.com/codeigniter/application/third_party/CIUnit/PHPUnit/Autoload.php on line 209

That function does exist and inside the Filesystem. Line 92

 public static function fileExistsInIncludePath($file)

So not sure now what the problem is.

  • 写回答

1条回答 默认 最新

  • dongwu8064 2014-07-15 18:59
    关注

    Deleted old PHPUnit installation and just used phpunit.phar downloaded from the phpunit website.

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

    This took take of any issues. If running models for example it should be:

    phpunit models/
    

    Works fine now.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?