add php-cs-fixer to list of fixers
This commit is contained in:
parent
1d0690f6d7
commit
fbbb8c17d9
9 changed files with 94 additions and 2 deletions
0
test/command_callback/php_paths/project-with-php-cs-fixer/vendor/bin/php-cs-fixer
vendored
Normal file
0
test/command_callback/php_paths/project-with-php-cs-fixer/vendor/bin/php-cs-fixer
vendored
Normal file
46
test/fixers/test_php_cs_fixer.vader
Normal file
46
test/fixers/test_php_cs_fixer.vader
Normal file
|
@ -0,0 +1,46 @@
|
|||
Before:
|
||||
Save g:ale_php_cs_fixer_executable
|
||||
let g:ale_php_cs_fixer_executable = 'php-cs-fixer'
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
silent cd ..
|
||||
silent cd command_callback
|
||||
let g:dir = getcwd()
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
|
||||
Execute(project with php-cs-fixer should use local by default):
|
||||
call ale#test#SetFilename('php_paths/project-with-php-cs-fixer/test.php')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/php_paths/project-with-php-cs-fixer/vendor/bin/php-cs-fixer'),
|
||||
\ ale#fixers#php_cs_fixer#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(use-global should override local detection):
|
||||
let g:ale_php_cs_fixer_use_global = 1
|
||||
call ale#test#SetFilename('php_paths/project-with-php-cs-fixer/test.php')
|
||||
|
||||
AssertEqual
|
||||
\ 'php-cs-fixer',
|
||||
\ ale#fixers#php_cs_fixer#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(project without php-cs-fixer should use global):
|
||||
call ale#test#SetFilename('php_paths/project-without-php-cs-fixer/test.php')
|
||||
|
||||
AssertEqual
|
||||
\ 'php-cs-fixer',
|
||||
\ ale#fixers#php_cs_fixer#GetExecutable(bufnr(''))
|
||||
|
||||
|
||||
|
||||
|
||||
Execute(The php-cs-fixer callback should return the correct default values):
|
||||
call ale#test#SetFilename('php_paths/project-without-php-cs-fixer/foo/test.php')
|
||||
|
||||
AssertEqual
|
||||
\ {'read_temporary_file': 1, 'command': ale#Escape('php-cs-fixer') . ' fix %t' },
|
||||
\ ale#fixers#php_cs_fixer#Fix(bufnr(''))
|
Loading…
Add table
Add a link
Reference in a new issue