2017-08-20 05:47:21 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_php_phpcbf_executable
|
|
|
|
Save g:ale_php_phpcbf_standard
|
|
|
|
Save g:ale_php_phpcbf_use_global
|
|
|
|
|
|
|
|
let g:ale_php_phpcbf_executable = 'phpcbf_test'
|
|
|
|
let g:ale_php_phpcbf_standard = ''
|
2020-11-21 20:19:02 +00:00
|
|
|
let g:ale_php_phpcbf_options = ''
|
2017-08-20 05:47:21 +00:00
|
|
|
let g:ale_php_phpcbf_use_global = 0
|
|
|
|
|
|
|
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
|
|
|
|
Execute(project with phpcbf should use local by default):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
|
2017-08-20 05:47:21 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf'),
|
2017-08-20 05:47:21 +00:00
|
|
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(use-global should override local detection):
|
|
|
|
let g:ale_php_phpcbf_use_global = 1
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
|
2017-08-20 05:47:21 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'phpcbf_test',
|
|
|
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(project without phpcbf should use global):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-without-phpcbf/foo/test.php')
|
2017-08-20 05:47:21 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'phpcbf_test',
|
|
|
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The phpcbf callback should return the correct default values):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
|
2017-08-20 05:47:21 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2021-03-20 22:11:22 +00:00
|
|
|
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s -' },
|
2017-08-20 05:47:21 +00:00
|
|
|
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The phpcbf callback should include the phpcbf_standard option):
|
|
|
|
let g:ale_php_phpcbf_standard = 'phpcbf_ruleset.xml'
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
|
2017-08-20 05:47:21 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2021-03-20 22:11:22 +00:00
|
|
|
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml' . ' -'},
|
2017-10-01 19:23:41 +00:00
|
|
|
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
|
|
|
|
2020-11-21 20:19:02 +00:00
|
|
|
Execute(User provided options should be used):
|
|
|
|
let g:ale_php_phpcbf_options = '--my-user-provided-option my-value'
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
|
2020-11-21 20:19:02 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2021-03-20 22:11:22 +00:00
|
|
|
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . ale#Pad('--my-user-provided-option my-value') . ' -'},
|
2020-11-21 20:19:02 +00:00
|
|
|
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
|
|
|
|
|
|
|
|
2017-10-01 19:23:41 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_php_phpcbf_executable
|
|
|
|
Save g:ale_php_phpcbf_standard
|
|
|
|
Save g:ale_php_phpcbf_use_global
|
|
|
|
|
|
|
|
let g:ale_php_phpcbf_executable = 'phpcbf_test'
|
|
|
|
let g:ale_php_phpcbf_standard = ''
|
2020-11-21 20:19:02 +00:00
|
|
|
let g:ale_php_phpcbf_options = ''
|
2017-10-01 19:23:41 +00:00
|
|
|
let g:ale_php_phpcbf_use_global = 0
|
|
|
|
|
|
|
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
|
|
|
|
Execute(project with phpcbf should use local by default):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
|
2017-10-01 19:23:41 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf'),
|
2017-10-01 19:23:41 +00:00
|
|
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(use-global should override local detection):
|
|
|
|
let g:ale_php_phpcbf_use_global = 1
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
|
2017-10-01 19:23:41 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'phpcbf_test',
|
|
|
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(project without phpcbf should use global):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-without-phpcbf/foo/test.php')
|
2017-10-01 19:23:41 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'phpcbf_test',
|
|
|
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The phpcbf callback should return the correct default values):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
|
2017-10-01 19:23:41 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2021-03-20 22:11:22 +00:00
|
|
|
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s -' },
|
2017-10-01 19:23:41 +00:00
|
|
|
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The phpcbf callback should include the phpcbf_standard option):
|
|
|
|
let g:ale_php_phpcbf_standard = 'phpcbf_ruleset.xml'
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php')
|
2017-10-01 19:23:41 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2021-03-20 22:11:22 +00:00
|
|
|
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml' . ' -'},
|
2017-08-20 05:47:21 +00:00
|
|
|
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
|
|
|
|