From 9aba0aea230b9d4563a14381b18da1c0e9be6e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ellis=20Keny=C5=91?= Date: Mon, 18 Oct 2021 00:37:32 +0100 Subject: [PATCH] fix(php): let +phpunit-docker-compose-mode be disabled (#5648) --- modules/lang/php/README.org | 10 +++++++--- modules/lang/php/config.el | 9 ++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/lang/php/README.org b/modules/lang/php/README.org index d0b2c6d92..2883e3f74 100644 --- a/modules/lang/php/README.org +++ b/modules/lang/php/README.org @@ -198,11 +198,15 @@ A lot of projects rely on running inside docker compose (ie Laravel), and as such a minor mode has been configured to attempt to run tests inside the =php-fpm= (by default) container. -If for some reason you wish to specify a different container, modify the -~+php/default-docker-container~ variable (ideally inside a ~.dir-locals.el~ file) +This mode is disabled by default, to opt-in set =+php-run-tests-in-docker= to =t= in +your config. If this is done during Emacs running, you will also have to reload +=php-mode= (i.e. through =M-x php-mode=) + +If you wish to specify a different container, modify the +~+php-default-docker-container~ variable (ideally inside a ~.dir-locals.el~ file) #+begin_src emacs-lisp -((php-mode . ((+php/default-docker-container . "php-octane")))) +((php-mode . ((+php-default-docker-container . "php-octane")))) #+end_src * Troubleshooting diff --git a/modules/lang/php/config.el b/modules/lang/php/config.el index 78623c4a2..a9daf488d 100644 --- a/modules/lang/php/config.el +++ b/modules/lang/php/config.el @@ -9,6 +9,9 @@ (defvar +php-default-docker-compose "docker-compose.yml" "Path to docker-compose file.") +(defvar +php-run-tests-in-docker nil + "Whether or not to run tests in a docker environment") + (after! projectile (add-to-list 'projectile-project-root-files "composer.json")) @@ -164,8 +167,12 @@ :files ("composer.json")) (def-project-mode! +phpunit-docker-compose-mode + :when +php-run-tests-in-docker :modes '(php-mode docker-compose-mode) :files (and "phpunit.xml" (or +php-default-docker-compose "docker-compose.yml")) :on-enter (setq phpunit-args `("exec" ,+php-default-docker-container "php" "vendor/bin/phpunit") - phpunit-executable (executable-find "docker-compose"))) + phpunit-executable (executable-find "docker-compose")) + :on-exit + (setq phpunit-args nil + phpunit-executable nil))