PHPUnit via Composer in Moodle 2.4

Starting in Moodle 2.4 the recommended way to install PHPUnit for Moodle testing is via Composer dependency manager.

Benefits compared to old-style PEAR installations

  • much easier installation
  • local installation in Moodle dirroot
  • safe and easy upgrades

Installation in *nix

$ cd /your/moodle/dirroot
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install

Test execution in *nix

$ cd /your/moodle/dirroot
$ vendor/bin/phpunit

See http://docs.moodle.org/dev/PHPUnit for more information about testing of Moodle code with PHPUnit.

Leave a Reply