Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
655 views
in Technique[技术] by (71.8m points)

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

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

C:xampphtdocsunittest>phpunit UnitTest usertest.php
PHP Warning:  require_once(File/Iterator/Autoload.php): failed to open stream No such file or directory in C:xamppphppearPHPUnitAutoload.php on line 45
PHP Stack trace:
PHP   1. {main}() C:xamppphpphpunit:0
PHP   2. require() C:xamppphpphpunit:41

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

Call Stack:
    0.0004     325352   1. {main}() C:xamppphpphpunit:0
    0.0026     366520   2. require('C:xamppphppearPHPUnitAutoload.php')xamppphpphpunit:41

PHP Fatal error:  require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.;C:phppear') in C:xamppphppearPHPUnitAutoload.php on line 45
PHP Stack trace:
PHP   1. {main}() C:xamppphpphpunit:0'

could anyone give solution to this ??

Note: i am using windows 7.

Thanks,

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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:wampinphpphp5.3.8PEARPEAR"

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...