Skip to content

Instantly share code, notes, and snippets.

@nick-f
Created April 16, 2019 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nick-f/e255b4d96238d7a3bd56994e137f3e10 to your computer and use it in GitHub Desktop.
Save nick-f/e255b4d96238d7a3bd56994e137f3e10 to your computer and use it in GitHub Desktop.
Vim mappings for running PHPUnit tests
" Run the whole test suite
nnoremap <leader>TS :!./vendor/bin/phpunit<cr>
" Run all tests in the current file
nnoremap <leader>T :!./vendor/bin/phpunit %<cr>
" Place your cursor within the test function to run a single test
" Need to install https://github.com/tyru/current-func-info.vim
function! RunPhpUnitTest()
let testFunction=cfi#format("%s", "")
execute '! ./vendor/bin/phpunit --filter='testFunction
endfunction
nnoremap <leader>t :call RunPhpUnitTest()<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment