]> git.madduck.net Git - etc/vim.git/blob - test/fixers/test_php_cs_fixer.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / fixers / test_php_cs_fixer.vader
1 Before:
2   Save g:ale_php_cs_fixer_executable
3   Save g:ale_php_cs_fixer_options
4   Save g:ale_php_cs_fixer_fix_options
5   let g:ale_php_cs_fixer_executable = 'php-cs-fixer'
6   let g:ale_php_cs_fixer_options = ''
7   let g:ale_php_cs_fixer_fix_options = ''
8
9   call ale#test#SetDirectory('/testplugin/test/fixers')
10
11 After:
12   Restore
13
14   call ale#test#RestoreDirectory()
15
16
17 Execute(project with php-cs-fixer should use local by default):
18   call ale#test#SetFilename('../test-files/php/project-with-php-cs-fixer/test.php')
19
20   AssertEqual
21   \ ale#path#Simplify(g:dir . '/../test-files/php/project-with-php-cs-fixer/vendor/bin/php-cs-fixer'),
22   \ ale#fixers#php_cs_fixer#GetExecutable(bufnr(''))
23
24 Execute(use-global should override local detection):
25   let g:ale_php_cs_fixer_use_global = 1
26   call ale#test#SetFilename('../test-files/php/project-with-php-cs-fixer/test.php')
27
28   AssertEqual
29   \ 'php-cs-fixer',
30   \ ale#fixers#php_cs_fixer#GetExecutable(bufnr(''))
31
32 Execute(project without php-cs-fixer should use global):
33   call ale#test#SetFilename('../test-files/php/project-without-php-cs-fixer/test.php')
34
35   AssertEqual
36   \ 'php-cs-fixer',
37   \ ale#fixers#php_cs_fixer#GetExecutable(bufnr(''))
38
39
40
41
42 Execute(The php-cs-fixer callback should return the correct default values):
43   call ale#test#SetFilename('../test-files/php/project-without-php-cs-fixer/foo/test.php')
44
45   AssertEqual
46   \ {
47   \   'read_temporary_file': 1,
48   \   'command': ale#Escape('php-cs-fixer')
49   \      . ' ' . g:ale_php_cs_fixer_options
50   \      . ' fix ' . g:ale_php_cs_fixer_fix_options
51   \      . ' %t'
52   \ },
53   \ ale#fixers#php_cs_fixer#Fix(bufnr(''))
54
55 Execute(The php-cs-fixer callback should include custom php-cs-fixer options):
56   let g:ale_php_cs_fixer_options = '-nq'
57   let g:ale_php_cs_fixer_fix_options = '--config="$HOME/.php_cs"'
58   call ale#test#SetFilename('../test-files/php/project-without-php-cs-fixer/test.php')
59
60   AssertEqual
61   \ {
62   \   'command': ale#Escape(g:ale_php_cs_fixer_executable)
63   \     . ' -nq fix --config="$HOME/.php_cs" %t',
64   \   'read_temporary_file': 1,
65   \ },
66   \ ale#fixers#php_cs_fixer#Fix(bufnr(''))