It's now 2 days that I've been trying to get phpunit working on my OSX. I'm running php from a MAMP installation.
I have installed it via PEAR with all dependencies. The phpunit --version command is working and displays :
$ phpunit --version
PHPUnit 3.6.10 by Sebastian Bergmann.
But when I run a test from the command line it shows :
Warning: require_once(/Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Framework): failed to open stream: No such file or directory in /Users/magalie/Sites/HelloWorld/HelloWorldTest.php on line 3
Call Stack:
0.0028 632128 1. {main}() /Applications/MAMP/bin/php/php5.3.6/bin/phpunit:0
0.0078 1161288 2. PHPUnit_TextUI_Command::main() /Applications/MAMP/bin/php/php5.3.6/bin/phpunit:46
0.0078 1162016 3. PHPUnit_TextUI_Command->run() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/TextUI/Command.php:130
0.1109 1793352 4. PHPUnit_Runner_BaseTestRunner->getTest() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/TextUI/Command.php:150
0.1109 1793352 5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Runner/BaseTestRunner.php:104
0.1115 1837832 6. PHPUnit_Runner_StandardTestSuiteLoader->load() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Runner/BaseTestRunner.php:168
0.1126 1983864 7. PHPUnit_Util_Fileloader::checkAndLoad() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Runner/StandardTestSuiteLoader.php:78
0.1127 1983984 8. PHPUnit_Util_Fileloader::load() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Util/Fileloader.php:79
0.1128 1994704 9. include_once('/Users/magalie/Sites/HelloWorld/HelloWorldTest.php') /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Util/Fileloader.php:95
Fatal error: require_once(): Failed opening required 'PHPUnit/Framework' (include_path='.:/Applications/MAMP/bin/php/php5.3.6/lib/php:/Applications/MAMP/bin/php5.3/lib/php/PEAR:/usr/lib/php') in /Users/magalie/Sites/HelloWorld/HelloWorldTest.php on line 3
Call Stack:
0.0028 632128 1. {main}() /Applications/MAMP/bin/php/php5.3.6/bin/phpunit:0
0.0078 1161288 2. PHPUnit_TextUI_Command::main() /Applications/MAMP/bin/php/php5.3.6/bin/phpunit:46
0.0078 1162016 3. PHPUnit_TextUI_Command->run() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/TextUI/Command.php:130
0.1109 1793352 4. PHPUnit_Runner_BaseTestRunner->getTest() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/TextUI/Command.php:150
0.1109 1793352 5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Runner/BaseTestRunner.php:104
0.1115 1837832 6. PHPUnit_Runner_StandardTestSuiteLoader->load() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Runner/BaseTestRunner.php:168
0.1126 1983864 7. PHPUnit_Util_Fileloader::checkAndLoad() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Runner/StandardTestSuiteLoader.php:78
0.1127 1983984 8. PHPUnit_Util_Fileloader::load() /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Util/Fileloader.php:79
0.1128 1994704 9. include_once('/Users/magalie/Sites/HelloWorld/HelloWorldTest.php') /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Util/Fileloader.php:95
Here is the configuration from pear
Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels auto_discover 1
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 /Applications/MAMP/bin/php/php5.3.6/bin
PEAR documentation directory doc_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/doc
PHP extension directory ext_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions
PEAR directory php_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/
PEAR Installer cache directory cache_dir /var/folders/qH/qHdMKNY5GsywPNMBPX-T7U+++TI/-Tmp-//pear/cache
PEAR configuration file cfg_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/cfg
directory
PEAR data directory data_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/data
PEAR Installer download download_dir /var/folders/qH/qHdMKNY5GsywPNMBPX-T7U+++TI/-Tmp-//pear/download
directory
PHP CLI/CGI binary php_bin /Applications/MAMP/bin/php/php5.3.6/bin/php
php.ini location php_ini /Applications/MAMP/bin/php/php5.3.6/conf/php.ini
--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 /var/folders/qH/qHdMKNY5GsywPNMBPX-T7U+++TI/-Tmp-//pear/temp
PEAR test directory test_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/tests
PEAR www files directory www_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/www
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 /Applications/MAMP/bin/php/php5.3.6/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/magalie/.pearrc
System Configuration File Filename /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf
and phpunit is run from /usr/lib/php which is part of $PATH
And this is the content of my HElloWorldTest.php file, I have already tried with or without the php extension to Framework file with no success.
<?php
require_once 'HelloWorld.php';
require_once 'PHPUnit/Framework';
///Applications/MAMP/bin/php/php5.3.6/lib/php/
class HelloWorldTest extends PHPUnit_Framework_TestCase
{
public function test__construct()
{
$hw = new HelloWorld();
$this->assertType('HelloWorld, $hw');
}
public function testSayHello()
{
$hw = new HelloWorld();
$string = $hw->sayHello();
$this->asserEquals('Hello World!', $string);
}
}
I have already tried to uninstall and reinstall phpunit, with no luck. And looking in the PHPUnit directory, there is no Framework.php file.
SO what am I doing wrong ? Is there anybody who had the same issue ? How did you solve it ? This is driving me crazy, and I have the impression to run in circles ...
Thanks for your help.