test_phpstan_handler.vader
1 Before: 2 call ale#test#SetDirectory('/testplugin/test') 3 4 runtime ale_linters/php/phpstan.vim 5 6 After: 7 call ale#test#RestoreDirectory() 8 call ale#linter#Reset() 9 10 Execute(Output without errors should be parsed correctly): 11 call ale#test#SetFilename('phpstan-test-files/foo/test.php') 12 13 AssertEqual 14 \ [], 15 \ ale_linters#php#phpstan#Handle(bufnr(''), [ 16 \ '{"totals":{"errors":0,"file_errors":0},"files":[],"errors":[]}', 17 \ ]) 18 19 Execute(Output with some errors should be parsed correctly): 20 call ale#test#SetFilename('phpstan-test-files/foo/test.php') 21 22 AssertEqual 23 \ [ 24 \ { 25 \ 'lnum': 9, 26 \ 'text': 'Call to method format() on an unknown class DateTimeImutable.', 27 \ 'type': 'E' 28 \ }, 29 \ { 30 \ 'lnum': 16, 31 \ 'text': 'Sample message.', 32 \ 'type': 'E' 33 \ }, 34 \ { 35 \ 'lnum': 192, 36 \ 'text': 'Invalid command testCommand.', 37 \ 'type': 'E' 38 \ } 39 \ ], 40 \ ale_linters#php#phpstan#Handle(bufnr(''), [json_encode( 41 \ { 42 \ "totals":{"errors": 0, "file_errors": 11}, 43 \ "files":{expand('%:p'): {"errors": 3, "messages": [ 44 \ {"message": "Call to method format() on an unknown class DateTimeImutable.", "line":9}, 45 \ {"message": "Sample message.", "line":16}, 46 \ {"message": "Invalid command testCommand.", "line": 192} 47 \ ]}} 48 \ }, 49 \)])