NOTE: the page is not maintained, please submit patches if you know how to make this work
- Install Docker extension from Microsoft
- Add mdc.env to your Moodle project
- Create containers with
mdc-rebuild
- Initialise phpunit with
phpunit-init
- Install Better PHPUnit extension
- Update VSCode configuration (note you need to edit project path):
{
"better-phpunit.docker.command": "docker compose -f compose.yaml exec webserver",
"better-phpunit.docker.enable": true,
"better-phpunit.phpunitBinary": "vendor/bin/phpunit",
"better-phpunit.docker.paths": {
"/path/to/your/moodle": "/var/www/html"
},
"better-phpunit.xmlConfigFilepath": "/var/www/html/phpunit.xml"
}
- Open a test file, go to method and press Cmd+shif+p and select one of Better PHPUnit options to run tests.