2017-06-21 20:35:40 +00:00
|
|
|
Before:
|
2017-06-21 21:33:34 +00:00
|
|
|
Save g:ale_php_phpcs_executable
|
|
|
|
Save g:ale_php_phpcs_use_global
|
|
|
|
|
2017-06-21 20:35:40 +00:00
|
|
|
let g:ale_php_phpcs_executable = 'phpcs_test'
|
2017-06-21 21:33:34 +00:00
|
|
|
let g:ale_php_phpcs_use_global = 0
|
2017-06-21 20:35:40 +00:00
|
|
|
|
|
|
|
silent! cd /testplugin/test
|
|
|
|
let g:dir = getcwd()
|
|
|
|
|
|
|
|
runtime ale_linters/php/phpcs.vim
|
|
|
|
|
|
|
|
After:
|
2017-06-21 21:33:34 +00:00
|
|
|
Restore
|
2017-06-21 20:35:40 +00:00
|
|
|
|
2017-06-21 21:33:34 +00:00
|
|
|
silent execute 'cd ' . fnameescape(g:dir)
|
2017-06-21 20:35:40 +00:00
|
|
|
unlet! g:dir
|
|
|
|
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(project with phpcs should use local by default):
|
2017-06-21 21:33:34 +00:00
|
|
|
call ale#test#SetFilename('phpcs-test-files/project-with-phpcs/foo/test.php')
|
2017-06-21 20:35:40 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ g:dir . '/phpcs-test-files/project-with-phpcs/vendor/bin/phpcs',
|
|
|
|
\ ale_linters#php#phpcs#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(use-global should override local detection):
|
|
|
|
let g:ale_php_phpcs_use_global = 1
|
|
|
|
|
2017-06-21 21:33:34 +00:00
|
|
|
call ale#test#SetFilename('phpcs-test-files/project-with-phpcs/foo/test.php')
|
2017-06-21 20:35:40 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'phpcs_test',
|
|
|
|
\ ale_linters#php#phpcs#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(project without phpcs should use global):
|
2017-06-21 21:33:34 +00:00
|
|
|
call ale#test#SetFilename('phpcs-test-files/project-without-phpcs/foo/test.php')
|
2017-06-21 20:35:40 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'phpcs_test',
|
|
|
|
\ ale_linters#php#phpcs#GetExecutable(bufnr(''))
|