Joachim Kudish
Joachim Kudish

Reputation: 43

Getting codeception & phpunit working on MAMP with OS X Lion

Running:

My goal is to get the Codeception testing framework to work and use within my MAMP project. I'm following the instructions here on how to install it.

Pear is installed and working fine. I am able to get Codeception installed with these commands:

$ pear channel-discover codeception.com/pear
$ pear install codeception/Codeception

Once installed when I try to run the codecept commands I get the following error:

Warning: require_once(Codeception/autoload.php): failed to open stream: No such file or directory in /usr/bin/codecept on line 12
Fatal error: require_once(): Failed opening required 'Codeception/autoload.php' (include_path='.:') in /usr/bin/codecept on line 12

I think that the issue is caused by either:

Also of interest

For reference:

Any Help? Suggestions?


Thanks to Davert's help - I was able to confirm that this is a conflict with MAMP's copy of PHP and Lion's built-in copy of PHP. To solve the issue I created a new php.ini file in /etc that was a duplicate of php.ini.default and changed the include_path to /Applications/MAMP/bin/php/php5.3.6/lib/php

Upvotes: 4

Views: 2231

Answers (2)

ZeFredz
ZeFredz

Reputation: 1

One solution that worked for me was to edit /Applications/MAMP/bin/php5.3/bin/codecept and replace /usr/bin/php at the first line by /Applications/MAMP/bin/php5.3/bin/php

Upvotes: 0

Davert
Davert

Reputation: 314

I think the problem is: your PEAR command was executed from bundled PHP. So your primary MAMP PHP libraries in (/Applications/MAMP/bin/php/php5.3.6/bin/pear) were not updated. I suggest you should find the second PEAR were the Codeception was exctually stored. And add path to it into 'include_path' in php.ini.

Yes, PEAR is quite buggy. In next releases a Composer installator will be added.

Also, you can try to use Phar executable.

In this case a Codeception should be executed with:

php codecept.phar

Upvotes: 3

Related Questions