Support for running phpunit inside of a docker container
It is not possible to run phpunit inside of docker container. Would it be possible to allow support for this. To at least, allow to change the path to the phpunit bin path
I had no issues with this .dir-locals.el file placed at the root of my project.
((php-mode . ((phpunit-args . ("exec" "php" "bin/phpunit"))
(phpunit-executable . "docker-compose"))))
adapt to your needs.
Here's how I made it work, with a docker-compose.yml file not in the root of the project, with it's .env file also not in the root of the project.
Generally, I have all my docker config stuff in a directory called docker_config in the root of my project.
((php-mode . ((phpunit-args . ("-f" "docker_config/docker-compose.yml" "--project-directory" "docker_config" "exec" "php-fpm" "vendor/bin/phpunit"))
(phpunit-executable . "docker-compose"))))
there's also a phpunit-root-directory variable that might come in handy in case you're using a docker-compose.override.yml - this way you wouldn't have to list configuration files and/or --project-directory explicitly in phpunit-args:
((php-mode . ((phpunit-root-directory . "~/my-project/docker-config")
(phpunit-executable . "docker-compose")
(phpunit-args . ("run" "--rm" "php" "vendor/bin/phpunit")))))