diff options
author | w0rp <w0rp@users.noreply.github.com> | 2018-03-02 20:40:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-02 20:40:31 +0000 |
commit | ad7ffe287574745994811f345e0defd863e575a0 (patch) | |
tree | 063e947e495e4393074a934ba441fd7a7e5c4849 /test | |
parent | 2c2c7ceb1d2f3de97ba8a40dd7858e83b6755fcd (diff) | |
parent | fbbb8c17d9634304fd6d10789e78d00c75b70e07 (diff) | |
download | ale-ad7ffe287574745994811f345e0defd863e575a0.zip |
Merge pull request #1390 from jdeniau/jd-feat-phpCsFixer
add php-cs-fixer to list of fixers
Diffstat (limited to 'test')
4 files changed, 46 insertions, 0 deletions
diff --git a/test/command_callback/php_paths/project-with-php-cs-fixer/test.php b/test/command_callback/php_paths/project-with-php-cs-fixer/test.php new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/php_paths/project-with-php-cs-fixer/test.php diff --git a/test/command_callback/php_paths/project-with-php-cs-fixer/vendor/bin/php-cs-fixer b/test/command_callback/php_paths/project-with-php-cs-fixer/vendor/bin/php-cs-fixer new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/php_paths/project-with-php-cs-fixer/vendor/bin/php-cs-fixer diff --git a/test/command_callback/php_paths/project-without-php-cs-fixer/test.php b/test/command_callback/php_paths/project-without-php-cs-fixer/test.php new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/php_paths/project-without-php-cs-fixer/test.php diff --git a/test/fixers/test_php_cs_fixer.vader b/test/fixers/test_php_cs_fixer.vader new file mode 100644 index 00000000..b6579670 --- /dev/null +++ b/test/fixers/test_php_cs_fixer.vader @@ -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('')) |