Installing PHPUnit with MAMP and Eclipse

Monday, 2 February, 2009

Had a case the other day to install PHPUnit for Eclipse. Googled it a bit, but found no good examples.

Anyway here is how you do it:

  1. Go to this address http://pear.phpunit.de/get/
  2. There, you can download the latest version of PHPUnit. For me it was PHPUnit-3.3.9.tgz
  3. Extract then the folder structure will look something like this:
    mappestruktur
  4. Place PHPUnit folder and pear-phpunit file: / Applications/MAMP/bin/php5/lib/php /
  5. Open pear-phpunit in your favorite editor and replace all @ @ php_bin with / Applications/MAMP/bin/php5/bin/php
  6. Then open the PHPUnit / Util / Fileloader.php to replace @ @ with php_bin / Applications/MAMP/bin/php5/bin/php
  7. Then go into eclipse to open the External Tools Configuration
    external tools
  8. Create a new configuration that looks like this:
    config
  9. Finally you must edit the php.ini file located in / Applications/MAMP/conf/php5
  10. include_path must contain the path to your project in eclipse, for example:
  11. include_path = ".: / Applications/MAMP/bin/php5/lib/php: / Users / Geir / Documents / Development / Project PHP / src / main / php"
  12. Go into eclipse, click once in the window with the tests and run the External Tools config you made

Good luck!

Categories → PHP

    A comment

    1. This works really well. But you must remember to restart eclipse after config.

    Write a comment