Created
August 3, 2012 08:18
-
-
Save dmj/3245746 to your computer and use it in GitHub Desktop.
Helper functions for eproject/phix-project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun dmaus/phix-project/jump-to-unit-test () | |
(interactive) | |
(let ((project-root (eproject-root))) | |
(when project-root | |
(let ((unit-test-file | |
(expand-file-name | |
(concat (file-name-sans-extension (file-relative-name (buffer-file-name) (expand-file-name "src/php" project-root))) | |
"Test." (file-name-extension (buffer-file-name))) | |
(expand-file-name "src/tests/unit-tests/php" project-root)))) | |
(switch-to-buffer (or (find-buffer-visiting unit-test-file) | |
(find-file-noselect unit-test-file))))))) | |
(defun dmaus/php-project/run-phpunit () | |
(interactive) | |
(let ((project-root (eproject-root))) | |
(when project-root | |
(let ((phpunit-buffer (get-buffer-create "*PHPUNIT*"))) | |
(display-buffer phpunit-buffer) | |
(with-current-buffer phpunit-buffer | |
(erase-buffer) | |
(cd project-root) | |
(call-process "phpunit" nil t t)))))) | |
(define-key php-mode-map (kbd "C-c C-t") #'dmaus/php-project/run-phpunit) | |
(define-key php-mode-map (kbd "C-c C-j") #'dmaus/phix-project/jump-to-unit-test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment