[Solved] Unit test can't find File/Iterator

Hi all,

I’m working my way through this useful book. This is the first problem I haven’t been able to solve via web searching.

Got PHPUnit and Selenium installed and successfully ran unit tests in Chapter 3 for the demo project. But trying the trackstar unit test failed. And going back to the demo unit test, it failed also, with the same message:

amd @ /Library/WebServer/Documents/demo/protected/tests: phpunit unit/MessageTest.php

Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /usr/lib/php/PHPUnit/Autoload.php on line 45

Fatal error: require_once(): Failed opening required ‘File/Iterator/Autoload.php’ (include_path=’.:’) in /usr/lib/php/PHPUnit/Autoload.php on line 45

Now… what changed? I did make a change in php.ini, but I swear (famous last words) that I reverted. And then rebooted.

The "missing" file is definitely at /usr/lib/php/File/Iterator/Autoload.php. That include path in the error message looks suspiciously scant. Fix? Thanks for any tips.

AD

FWIW, the environment PATH as reported by phpinfo() is "/usr/bin:/bin:/usr/sbin:/sbin".

Solution: edit the /etc/php.ini file and change the include_path entry from

include_path = ".:/php/includes"

to

include_path = ".:/php/includes:/usr/lib/php"

Now why this wasn’t needed for earlier unit tests is a mystery. I think that PHP was getting its ini values not from /etc/php.ini.default (which already existed and also omitted the path I added) but from somewhere else. And then something I did convinced PHP to start using the .ini.default file. I edited it and then copied to plain old .ini file and searching for the File/ directory now succeeded.

AMD

I solved this problem by adding the following include path to my php.ini files, both under the main php directory and apache;

include_path = ".;C:\wamp\bin\php\php5.3.8\pear"