Phpunit is the wrong way

Does anyone know what I'm doing wrong? I installed phpunit and everything is fine when I'm in the / opt / local / PEAR directory, so if I go to the / opt / local / PEAR directory and run phpunit, I get:

PHPUnit 3.5.11 by Sebastian Bergman.
Usage: phpunit [switches] UnitTest [UnitTest.php]
phpunit [switches]
blah blah blah

but if I am on a different path, I get:

Warning: require_once (PHP / CodeCoverage / Filter.php): could not open the stream: such a file or directory in the / usr / local / bin / phpunit directory on line 38

Fatal error: require_once (): Could not open 'PHP / CodeCoverage / Filter.php' (include_path = '.: / Usr / lib / php') in / usr / local / bin / phpunit on line 38

I know something is wrong with my PATH. How can i fix this?

+7
source share
5 answers

Try adding /opt/local/PEAR to your php.ini include_path.

 //Before: include_path='.:/usr/lib/php' //After: include_path='.:/usr/lib/php:/opt/local/PEAR' 

You may also need to restart the web server for the changes to take effect.

And as RobertPitt comments, this can also be done at runtime without access to the php.ini file.

 <?php $path = '/opt/local/PEAR'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); ?> 
+8
source

The PEAR channel (pear.phpunit.de), which is used to distribute PHPUnit, must be registered in the local PEAR environment. In addition, the component PHPUnit depends on is hosted on additional PEAR channels.

 pear channel-discover pear.phpunit.de pear channel-discover components.ez.no pear channel-discover pear.symfony-project.com 

This needs to be done only once. Now the PEAR installer can be used to install packages from the PHPUnit channel:

 pear install phpunit/PHPUnit 
+7
source

In Ubuntu, I used

 pear config-set auto_discover 1 pear install pear.phpunit.de/PHP_CodeCoverage 
+5
source

For Ubuntu, edit this php.ini for the CLI:

  /usr/local/lib/php.ini 

add / usr / local / lib / php / to your include line

 include_path= "/opt/zend/library/:/var/www/library/:/usr/local/bin/pear/:/usr/local/lib/php/" 

A day came to me to understand this. Bingo.

If this does not work, try this, it will give you a hint where your PHP libraries are located.

 $ locate PHP_CodeCoverage 
+1
source

As far as I know, the PEAR installation method is coming to an end, this is what the github repository says about this.

https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method

0
source

All Articles