fatal error 'File/Iterator/Autoload.php' not found when running phpunit

后端 未结 11 1217
滥情空心
滥情空心 2020-12-09 08:30

I am getting this error while i tried to run testclass in phpunit.

C:\\xampp\\htdocs\\unittest>phpunit UnitTest usertest.php
PHP Warning:  require_once(Fi         


        
11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 08:57

    For me the fix was simple (Ubuntu 12.04). First I did a search to make sure the file existed and where it was located:

    locate Autoload.php
    

    Which should return results similar to this:

    /usr/share/php/File/Iterator/Autoload.php
    /usr/share/php/PHP/CodeCoverage/Autoload.php
    /usr/share/php/PHP/Depend/Autoload.php
    /usr/share/php/PHP/Invoker/Autoload.php
    /usr/share/php/PHP/Timer/Autoload.php
    /usr/share/php/PHP/Token/Stream/Autoload.php
    /usr/share/php/PHPCPD/Autoload.php
    /usr/share/php/PHPUnit/Autoload.php
    /usr/share/php/PHPUnit/Framework/MockObject/Autoload.php
    /usr/share/php/PHP_CodeBrowser/Autoload.php
    /usr/share/php/Text/Template/Autoload.php
    

    Then I checked my include_path, which was set correctly in /etc/php5/apache2/php.ini, but was still commented out in /etc/php5/cli/php.ini (the command line interface).

    Uncommenting this line worked for me:

    include_path = ".:/usr/share/php:/usr/include/php5"
    

    Pretty basic I know, but it's always the little things when setting up a new machine ;-)

提交回复
热议问题