public/lib/phpunit/readme.md
Composer is a dependency manager for PHP projects. It installs PHP libraries into /vendor/ subdirectory inside your moodle dirroot.
php composer.phar installYou need to create a new dataroot directory and specify a separate database prefix for the test environment, see config-dist.php for more information.
$CFG->phpunit_prefix = 'phpu_'; to your config.php file$CFG->phpunit_dataroot = '/path/to/phpunitdataroot'; to your config.php fileBefore first execution and after every upgrade the PHPUnit test environment needs to be initialised, this command also builds the phpunit.xml configuration files.
php admin/tool/phpunit/cli/init.phpvendor/bin/phpunit from dirroot directoryvendor/bin/phpunit lib/tests/phpunit_test.phpvendor/bin/phpunit -c mytestsuites.xmltests/ directory in your add-onlocal/mytest/tests/my_test.php file with my_test class that extends basic_testcase or advanced_testcasetest_*() methodsvendor/bin/phpunit local/mytest/tests/my_test.phpphp admin/tool/phpunit/cli/init.php to get the plugin tests included in main phpunit.xml configuration file\ instead of / in paths in examples above