Manage the PHPUnit tests from Emacs (>= 24.3)
The recommended way to install phpunit.el
is via MELPA:
M-x package-install phpunit.el
or Cask:
(depends-on "phpunit.el")
These functions are available :
phpunit-current-test
: launch unit tests for the current test in a classphpunit-current-class
: launch unit tests for the current classphpunit-current-project
: launch all unit testsphpunit-group
: launch PHPUnit for group
You can create some key bindings with these commands:
(define-key web-mode-map (kbd "C-t t") 'phpunit-current-test)
(define-key web-mode-map (kbd "C-t c") 'phpunit-current-class)
(define-key web-mode-map (kbd "C-t p") 'phpunit-current-project)
or use the minor mode :
(add-to-list 'auto-mode-alist '("\\.php$'" . phpunit-mode))
The following configuration variables are available:
(setq phpunit-configuration-file "phpunit.xml")
(setq phpunit-root-directory "./")
phpunit.el
use Cask for dependencies
management. Install it and retrieve dependencies :
$ curl -fsSL https://raw.githubusercontent.com/cask/cask/master/go | python
$ export PATH="$HOME/.cask/bin:$PATH"
$ cask
-
Launch unit tests from shell
$ make clean test
-
Using overseer :
Keybinding | Description |
---|---|
C-c , t | launch unit tests from buffer |
C-c , b | launch unit tests |
C-c , g | launch unit tests with tag (find, regexp, ...) |
- Tips:
If you want to launch a single unit test, add a specify tag :
(ert-deftest test-foobar ()
:tags '(current)
And launch it using : C-c , g and specify tag : current
See here
A changelog is available here.
See LICENSE.
Nicolas Lamirault nicolas.lamirault@gmail.com