phpunit and PEAR

less than 1 minute read

Back on the php unit tsting buzz today but when i ran ‘phpunit’ is got this

    assure@snapdragonubuntu:~/bhaa/zend/trunk$ phpunit PHP Warning:   require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38 PHP Fatal error: require_once(): Failed opening required ‘PHP/CodeCoverage/Filter.php’ (include_path=’.:/usr/share/php:/usr/share/pear’) in /usr/bin/phpunit on line 38 

The first solution is to include the php code coverage tool 

Once installed, try again but

assure@snapdragonubuntu:~$ phpunit –help PHP Fatal error: Call to undefined method PHP_CodeCoverage_Filter::getInstance() in /usr/bin/phpunit on line 39

It seems that the version of phpunit was fairly old so i followed

and updated PEAR and phpunit

assure@snapdragonubuntu:~$ pear list -c phpunit
Installed packages, channel ============================================ Package Version State File_Iterator 1.3.1 stable PHPUnit 3.6.7 stable PHPUnit_MockObject 1.1.0 stable PHP_CodeCoverage 1.1.1 stable PHP_Invoker 1.0.1 stable PHP_Timer 1.0.2 stable PHP_TokenStream 1.1.2 stable

I also added the phpunit to the include_php in my php.ini file



Leave a Comment