fix(php): let +phpunit-docker-compose-mode be disabled (#5648)

This commit is contained in:
Ellis Kenyő 2021-10-18 00:37:32 +01:00 committed by GitHub
parent 3e89872e8c
commit 9aba0aea23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View file

@ -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

View file

@ -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))