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.

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

报告相同问题?