Short answer: I can’t, but I’d be very very happy if someone could help me update this post to get it to install!
What I’ve tried so far…
1 | sudo port install pear-phpunit |
Unfortunately that gets PHPUnit installed to a point, then a dependancy fails:
1 2 3 4 5 | phpunit Warning: require_once(File /Iterator/Autoload .php): failed to open stream: No such file or directory in /opt/local/lib/php/pear/PHPUnit/Autoload .php on line 45 Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path= '.:' ) in /opt/local/lib/php/pear/PHPUnit/Autoload .php on line 45 |
The problem seems to be documented in this ticket: https://trac.macports.org/ticket/35291#comment:22
Here’s another port package, php5-phpunit I tried:
1 | sudo port install php5-unit |
I’m not sure why there’s two, but unfortunately this one fails differently:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | phpunit --version Warning: require_once(PHP /CodeCoverage/Filter .php): failed to open stream: No such file or directory in /opt/local/bin/phpunit on line 37 Call Stack: 0.0014 631040 1. {main}() /opt/local/bin/phpunit :0 Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:: /opt/local/lib/php/pear : /opt/local/lib/php ; ; Windows: \path1: /opt/local/lib/php/pear ') in /opt/local/bin/phpunit on line 37 Call Stack: 0.0014 631040 1. {main}() /opt/local/bin/phpunit :0 |
I’ve tried installing the packages manually through pear, with no joy. Something is very confused, and I’m fairly certain it’s me right now. Am I just caught between a bunch of broken ports here?
I found one solution here: PHPUnit installation in OS X. Scroll to “Install PEAR and PHPUnit”.
I didn’t install PEAR the way they did. I just fixed the PEAR path in the following file: /opt/local/var/db/php54/pear/pear-ini.php.
Before:
set_include_path ( get_include_path ( ) . PATH_SEPARATOR . '/opt/local/lib/php/pear' );
After:
set_include_path ( get_include_path ( ) . PATH_SEPARATOR . '/opt/local/lib/php54/pear' );
Uninstall the MacPorts pear-PHPUnit package and then install phpunit manually as explained in the Moodle docs.
Thank you! You saved me night)