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 | php
$ php composer.phar install

Test execution in *nix

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

See for more information about testing of Moodle code with PHPUnit.

Leave a Reply