;;; test-php.el --- Flycheck Specs: PHP -*- lexical-binding: t; -*-
;; Copyright (C) 2016 Sebastian Wiesner and Flycheck contributors
;; This file is not part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
;;; Commentary:
;; Specs for PHP support.
;;; Code:
(require 'flycheck-buttercup)
(describe "Language PHP"
(describe "The PHDMD error parser"
(it "parses PHPMD XML output"
(let ((phpmd-xml "
Avoid unused private fields such as '$FOO'.
Avoid unused private methods such as 'bar'.
Avoid unused parameters such as '$baz'.
"))
(expect (flycheck-parse-phpmd phpmd-xml 'checker 'buffer)
:to-be-equal-flycheck-errors
(list
(flycheck-error-new-at 21 nil 'warning
"Avoid unused private fields such as '$FOO'."
:id "UnusedPrivateField"
:checker 'checker
:buffer 'buffer
:filename "foo.php")
(flycheck-error-new-at 24 nil 'warning
"Avoid unused private methods such as 'bar'."
:id "UnusedPrivateMethod"
:checker 'checker
:buffer 'buffer
:filename "foo.php")
(flycheck-error-new-at 24 nil 'warning
"Avoid unused parameters such as '$baz'."
:id "UnusedFormalParameter"
:checker 'checker
:buffer 'buffer
:filename "foo.php")))))))
;;; test-php.el ends here