Skip to content

Instantly share code, notes, and snippets.

@tvlooy
Created January 26, 2013 20:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvlooy/4644554 to your computer and use it in GitHub Desktop.
Save tvlooy/4644554 to your computer and use it in GitHub Desktop.
phpunit zsh autocomplete support
#compdef phpunit.phar
_arguments -s -w \
'--list-groups[List available test groups]' \
'--tap[Report test execution progress in TAP format]' \
'--testdox[Report test execution progress in TestDox format]' \
'--colors[Use colors in output]' \
'--stderr[Write to STDERR instead of STDOUT]' \
'--stop-on-error[Stop execution upon first error]' \
'--stop-on-failure[Stop execution upon first error or failure]' \
'--stop-on-skipped[Stop execution upon first skipped test]' \
'--stop-on-incomplete[Stop execution upon first incomplete test]' \
'--strict[Run tests in strict mode]' \
'--debug[Display debugging information during test execution]' \
'--process-isolation[Run each test in a separate PHP process]' \
'--no-globals-backup[Do not backup and restore $GLOBALS for each test]' \
'--static-backup[Backup and restore static attributes for each test]' \
'--no-configuration[Ignore default configuration file (phpunit.xml)]' \
'--version[Prints the version and exits]' \
'(-v|--verbose)'{-v,--verbose}'[Output more verbose information]' \
'--log-junit[Log test execution in JUnit XML format to file]:log junit:_files -/' \
'--log-tap[Log test execution in TAP format to file]:log tap:_files -/' \
'--log-json[Log test execution in JSON format]:log json:_files -/' \
'--coverage-clover[Generate code coverage report in Clover XML format]:coverage clover:_files -/' \
'--coverage-html[Generate code coverage report in HTML format]:coverage html:_files -/' \
'--coverage-php[Serialize PHP_CodeCoverage object to file]:coverage php:_files -/' \
'--coverage-text=[Generate code coverage report in text format. Default to writing to the standard output]:coverage text:_files -/' \
'--testdox-html[Write agile documentation in HTML format to file]:testdoc html:_files -/' \
'--testdox-text[Write agile documentation in Text format to file]:testdoc text:_files -/' \
'--bootstrap[A "bootstrap" PHP file that is run before the tests]:bootstrap:_files -/' \
'--include-path[Prepend PHP include_path with given path(s)]:include path:_files -/' \
'(-c|--configuration)'{-c,--configuration}'[Read configuration from XML file]:configuration:_files -/' \
'--filter[Filter which tests to run]' \
'--testsuite[Filter which testsuite to run]' \
'--group[Only runs tests from the specified group(s)]' \
'--exclude-group[Exclude tests from the specified group(s)]' \
'--test-suffix[Only search for test in files with specified suffix(es). Default: Test.php,.phpt]' \
'--loader[TestSuiteLoader implementation to use]' \
'--printer[TestSuiteListener implementation to use]' \
'--repeat[Runs the test(s) repeatedly]' \
'-d[Sets a php.ini value]' \
'(-)'{-h,--help}'[Prints this usage information]' \
'*:file:_files -/' && return 0
@tvlooy
Copy link
Author

tvlooy commented Jan 26, 2013

The thing behind this is called "compinit". Just run "echo $fpath" to see the directories where plugins are loaded (eg: /home/whoami/.oh-my-zsh/functions). Create a file there called _phpunit.phar

What it looks like on my machine https://twitter.com/tvlooy/status/295283184080408576

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment