PHPUnit installed but simply does not respond...

I am following along with the tutorials in 'Easy PHP Websites with Zend Framework' and wanted to install PHPUnit but have been trying to get it to work for about 5 hours now and am at my wits end.

System: Mac OS x Lion, PHP running locally (Not MAMP)

Pear was installed and working fine, I upgraded it to the latest.

Installed PHPUnit using

sudo pear install phpunit/PHPUnit

terminal did some work and installed it without errors

Then in my terminal I did

phpunit --version

this returns/does nothing as follows (Username removed)

Machine:~ Username$ phpunit --version
Machine:~ Username$ sudo phpunit --version
Machine:~ Username$ 

Was worried it some how did not install so I check for the PHPUnit files and they do exist under /usr/lib/php/phpunit

Also checked that the phpunit exe exists which it does under /usr/bin

edited .profile as well as .bash_profile to include the /usr/bin path to have

export PATH=/usr/bin:$PATH

then restarted terminal running

echo $PATH

shows

/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/Users/xxxxx/development/frameworks/ZendFramework-1.11.11/bin


php.ini includes is

include_path = ".:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library"

Where xxxxx is my username on the Mac

even going into /usr/bin in terminal and using phpunit --version returns nothing

in case its relevant my PEAR config shows

Configuration (channel pear.php.net):
=====================================
...
...
PEAR executables directory     bin_dir          /usr/bin
PEAR documentation directory   doc_dir          /usr/lib/php/doc
PHP extension directory        ext_dir          /usr/lib/php/extensions/.....
PEAR directory                 php_dir          /usr/lib/php
PEAR data directory            data_dir         /usr/lib/php/data
PHP CLI/CGI binary             php_bin          /usr/bin/php
php.ini location               php_ini          <not set>
....
....
PEAR Installer temp directory  temp_dir         /private/tmp/pear/temp
PEAR test directory            test_dir         /usr/lib/php/test
PEAR www files directory       www_dir          /usr/lib/php/htdocs
....

Also added the pear and phpunit directory to my php.ini includes path list.

I tried running PHPUnit in PHPUnit on AboutControllerTest.php file under my test directory and this gave me:

/usr/bin/php /private/var/folders/wy/nb6s7vlj56v7yyytntdhbr100000gp/T/ide-phpunit.php --bootstrap /Library/Server/Web/Data/Sites/learning/tests/bootstrap.php --configuration /Library/Server/Web/Data/Sites/learning/tests/phpunit.xml AboutControllerTest /Library/Server/Web/Data/Sites/learning/tests/application/controllers/AboutControllerTest.php
Testing started at 7:51 PM ...

Process finished with exit code 1
Cannot find PHPUnit in include path (.:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library:/usr/lib/php/PHPUnit:/usr/bin)

Am at a loss as to why this does not want to work. Am sure its me and I have done something incorrectly....Any help appreciated.

2 comments
Comment actions Permalink

Hi John,

1)

Process finished with exit code 1
Cannot find PHPUnit in include path (.:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library:/usr/lib/php/PHPUnit:/usr/bin)

This means that PHP (yes, php itself) cannot find phpunit files. Possibly installation is not completed properly .. or you have added wrong path to PEAR into php.ini. It's also possible that wrong php.ini is used.

2)

phpunit --version
this returns/does nothing

Well .. this means that you have issue with PHPUnit installation. Try reinstalling it maybe. You have to make this command work first. When it will start working -- only then you can look to make it work in PhpStorm.

3) You are saying:

Was worried it some how did not install so I check for the PHPUnit files and they do exist under /usr/lib/php/phpunit

But ... in php.ini you have

include_path = ".:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library"

Well .. dunno about you, but for me /usr/lib/php/phpunit is NOT located in your include path -- you have

/usr/lib/php/pear
only. Therefore -- check your paths in include_path variable of php.ini
0
Comment actions Permalink

Hi Andrly, thanks for your response.

I have uninstalled phpunit and reinstalled numerous times, supposedly successfully.

I am sure if I can simply get the 'phpunit --version' command to work everything else will fall into place.

This morning I have uninstalled phpunit again and reinstalled. Still does not work.

I also ensured that PEAR is looking at the correct php.ini file.

I searched the entire machine for any 'php.ini' files and only one exists, in /private/etc/


But ... in php.ini you have

include_path = ".:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library"

Well .. dunno about you, but for me /usr/lib/php/phpunit is NOT located in your include path -- you have

/usr/lib/php/pear
only

I have adjusted my php.ini to include the phpunit directory, but I still get this error within PHPStorm. I am ignoring PHPStorm for the moment though, cause phpunit will not even do anything from within the terminal.

Below is the output of my terminal session showing the uninstall, reinstall, PEAR config file values and PHP ini file location. Username removed.

PEAR uninstall and reinstall of phpunit

Johns-iMac:~ Username$ sudo pear uninstall phpunit/PHPUnit
phpunit/PHPUnit (version >= 3.6.0) is required by installed package "phpunit/DbUnit"
phpunit/PHPUnit (version >= 3.6.0) is required by installed package "phpunit/PHPUnit_Selenium"
phpunit/PHPUnit cannot be uninstalled, other installed packages depend on this package
Johns-iMac:~ Username$ sudo pear uninstall phpunit/DBUnit
uninstall ok: channel://pear.phpunit.de/DbUnit-1.1.2
Johns-iMac:~Username$ sudo pear uninstall phpunit/PHPUnit_Selenium
uninstall ok: channel://pear.phpunit.de/PHPUnit_Selenium-1.2.7
Johns-iMac:~ Username$ sudo pear uninstall phpunit/PHPUnit
uninstall ok: channel://pear.phpunit.de/PHPUnit-3.6.11
Johns-iMac:~ Username$ sudo pear config-show
Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels     auto_discover    <not set>
Default Channel                default_channel  pear.php.net
HTTP Proxy Server Address      http_proxy       <not set>
PEAR server [DEPRECATED]       master_server    pear.php.net
Default Channel Mirror         preferred_mirror pear.php.net
Remote Configuration File      remote_config    <not set>
PEAR executables directory     bin_dir          /usr/bin
PEAR documentation directory   doc_dir          /usr/lib/php/doc
PHP extension directory        ext_dir          /usr/lib/php/extensions/no-debug-non-zts-20090626
PEAR directory                 php_dir          /usr/lib/php
PEAR Installer cache directory cache_dir        /private/tmp/pear/cache
PEAR configuration file        cfg_dir          /usr/lib/php/cfg
directory
PEAR data directory            data_dir         /usr/lib/php/data
PEAR Installer download        download_dir     /private/tmp/pear/download
directory
PHP CLI/CGI binary             php_bin          /usr/bin/php
php.ini location               php_ini          /private/etc
--program-prefix passed to     php_prefix       <not set>
PHP's ./configure
--program-suffix passed to     php_suffix       <not set>
PHP's ./configure
PEAR Installer temp directory  temp_dir         /private/tmp/pear/temp
PEAR test directory            test_dir         /usr/lib/php/test
PEAR www files directory       www_dir          /usr/lib/php/htdocs
Cache TimeToLive               cache_ttl        3600
Preferred Package State        preferred_state  stable
Unix file mask                 umask            22
Debug Log Level                verbose          1
PEAR password (for             password         <not set>
maintainers)
Signature Handling Program     sig_bin          /usr/local/bin/gpg
Signature Key Directory        sig_keydir       /private/etc/pearkeys
Signature Key Id               sig_keyid        <not set>
Package Signature Type         sig_type         gpg
PEAR username (for             username         <not set>
maintainers)
User Configuration File        Filename         /Users/Username/.pearrc
System Configuration File      Filename         /private/etc/pear.conf
Johns-iMac:~ Username$ sudo pear channel-discover pear.phpunit.de
Channel "pear.phpunit.de" is already initialized
Johns-iMac:~ Username$ sudo pear install pear.phpunit.de/PHPUnit
Did not download optional dependencies: phpunit/PHP_Invoker, use --alldeps to download automatically
phpunit/PHPUnit can optionally use package "phpunit/PHP_Invoker" (version >= 1.1.0)
downloading PHPUnit-3.6.11.tgz ...
Starting to download PHPUnit-3.6.11.tgz (119,171 bytes)
..........................done: 119,171 bytes
install ok: channel://pear.phpunit.de/PHPUnit-3.6.11
Johns-iMac:~ Username$ phpunit
Johns-iMac:~ Username$ phpunit --version
Johns-iMac:~ Username$

Command php --ini returns

Johns-iMac:~ Username$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /private/etc/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
Johns-iMac:~ Username$

Command pear list-channels

Registered Channels:
====================
Channel                   Alias    Summary
components.ez.no          ezc      eZ Enterprise components
doc.php.net               phpdocs  PHP Documentation Team
pear.doctrine-project.org doctrine Doctrine PEAR channel
pear.php.net              pear     PHP Extension and Application
                                   Repository
pear.phpunit.de           phpunit  PHPUnit PEAR Channel
pear.symfony-project.com  symfony  The symfony project PEAR channel
pecl.php.net              pecl     PHP Extension Community Library
__uri                     __uri    Pseudo-channel for static packages

PEAR Version

Johns-iMac:~ Username$ pear -V
PEAR Version: 1.9.4
PHP Version: 5.3.8
Zend Engine Version: 2.3.0
Running on: Darwin Johns-iMac.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64
Johns-iMac:~ Username$

0

Please sign in to leave a comment.