Skip to content

Instantly share code, notes, and snippets.

@tonini
Created March 21, 2013 15:32
Show Gist options
  • Save tonini/5213948 to your computer and use it in GitHub Desktop.
Save tonini/5213948 to your computer and use it in GitHub Desktop.
(defun phpunit-command ()
"Returns the phpunit command path (vendor/bin or bin/ because of composer)"
(cond ((file-readable-p (concat (cabbage-project-root) "vendor/bin/phpunit"))
(concat (cabbage-project-root) "vendor/bin/phpunit"))
((file-readable-p (concat (cabbage-project-root) "bin/phpunit"))
(concat (cabbage-project-root) "bin/phpunit"))
(t "phpunit")))
(defun phpunit-config-file ()
"Returns a given phpunit config file if exists (check app/ because of symfony default.)"
(cond ((file-readable-p (concat (cabbage-project-root) "app/phpunit.xml"))
(format "%s %s" "-c" (concat (cabbage-project-root) "app/phpunit.xml")))
((file-readable-p (concat (cabbage-project-root) "phpunit.xml"))
(format "%s %s" "-c" (concat (cabbage-project-root) "phpunit.xml")))
(t "")))
(defun phpunit-default-options ()
(format "%s %s" (phpunit-config-file) "--colors"))
(defun phpunit-runner ()
"Returns command line to run phpunit"
(format "%s %s" (phpunit-command) (phpunit-default-options)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment