I want to contribute to a guys plugin (TimberWp). I’d like to do it with tests. his plugin has a test dir that looks just like the wp-cli scaffolded dir. all v standard.
Iv’e managed to get as far as installing wp-cli, phpunit (already had that) and I got past the couldn’t connect to mysql issue (make it use the mamp php5.4 version)
now, running:
WP_TESTS_DIR=~/sites/kindling/wp-unit-tests phpunit
gives me
Warning: require_once(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /Users/willbarker/sites/kindling/wp-unit-tests/includes/bootstrap.php on line 7
So i made sure my path to phpunit is set in my php.ini
timber git:(master) â php -r 'foreach (explode(":", get_include_path()) as $path) echo $path . PHP_EOL;'
.
/Applications/MAMP/bin/php/php5.4.4/lib/php
/usr/local/bin/phpunit
So i am out of ideas how to get phpunit working with WP. Have i got the right version of phpunit? its a phar, is that why i can’t include files from it? I’m obviously confused / running into the extent of my knowledge. Here is my installed phpunit version:
â timber git:(master) â phpunit --which
PHPUnit 3.7.28 by Sebastian Bergmann.
I have a setup similar to yours, with MAMP. I also have had this problem with PHPUnit. It seems that no matter what you do, PHPUnit does not recognize the
include_path
from MAMP. You have to add the correct path to thephp.ini
in/private/etc/
.I got this working. Possibly more by luck than judgement
As phpunit is a system thing, not a project thing phptherightway said to use pear to insall. I had it installed using composer.
So i installed it with pear:
http://ramonroche.com/2011/11/installing-phpunit-on-os-x-using-mamp-via-pear/
and then update my mamp php.ini include path
Then i cd’d to the plugin dir and ran
Hope that helps someone.