0
votes

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
How did you install phpunit? - zerkms
@zerkms the first iteration was using a zip file but then downloaded a phar file phpunit.de/getting-started.html Maybe i should delete the old phpunit that was created by zip file? - Hard Fitness

1 Answers

-1
votes

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.