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

后端 未结 11 1215
滥情空心
滥情空心 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 09:02

    After 2 days of post reading, finally i've solved with guides:

    Clean pc by hold/corrupted installation of Phpunit LINK

    and reinstalled with this guide LINK

    0 讨论(0)
  • 2020-12-09 09:06

    Look at the error:

     (include_path='.;C:\php\pear') in C:\xampp\php\pear\PHPUnit\Autoload.php
    

    The Xampp is trying to locate that file in include_path .;C:\php\pear But The path for the pear is .;C:\xampp\php\pear.

    Set the right path for the pear and it will work. I just made it.

    0 讨论(0)
  • 2020-12-09 09:14

    I had the same problem using PhP 5.3 on OSX 10.6 using the built-in server configuration.

    I noticed that while PHPUnit was being successfully installed to /usr/lib/php, Autoload.php was trying (line 45) to load the File Iterator from its current directory (/usr/lib/php/PHPUnit) rather than the directory Pear was installing it to (/usr/lib/php/File). Could this be a bug in the Pear installer?

    A simple ln -s /usr/lib/php/File /usr/lib/php/PHPUnit/File solved the problem.

    0 讨论(0)
  • 2020-12-09 09:15

    A possible reason that this might happen is that your php include_path is not set correctly. Please make sure you have the appropriate path to PEAR available. For my WAMP installation it would be:

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

    However, it will most likely be different on your system.

    A side note, you will want to update both your apache php.ini, as well as your php.ini located in your PHP installation folder. CLI the default php.ini, and web requests (and often times other software that you might be using PEAR packages for) will use the apache php.ini.

    Hope this helps.

    0 讨论(0)
  • 2020-12-09 09:15

    Checking pear config helped me find this quicky:

    bash-3.2# pear config-show | grep php_dir
    PEAR directory                 php_dir          /usr/local/pear/share/pear
    
    bash-3.2# vi /etc/php.ini
    include_path = ".:/php/includes:/usr/local/pear/share/pear"
    
    0 讨论(0)
提交回复
热议问题