-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from nlamirault/develop
Release 0.12.0
- Loading branch information
Showing
9 changed files
with
103 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
;;; Copyright (C) 2014-2016 Nicolas Lamirault <[email protected]> | ||
|
||
;;; 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 <http://www.gnu.org/licenses/>. | ||
|
||
;;; Scame Cask file | ||
|
||
(source "melpa" "http://stable.melpa.org/packages/") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (C) 2014, 2015 Nicolas Lamirault <[email protected]> | ||
# Copyright (C) 2014-2016 Nicolas Lamirault <[email protected]> | ||
|
||
# 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
# phpunit.el | ||
|
||
[![License GPL 3][badge-license]][LICENSE] | ||
[![Coverage Status](https://coveralls.io/repos/nlamirault/phpunit.el/badge.png)](https://coveralls.io/r/nlamirault/phpunit.el) | ||
|
||
Master : | ||
* [![MELPA Stable](https://stable.melpa.org/packages/phpunit-badge.svg)](https://stable.melpa.org/#/phpunit) | ||
* [![Circle CI](https://circleci.com/gh/nlamirault/phpunit.el/tree/master.svg?style=svg)](https://circleci.com/gh/nlamirault/phpunit.el/tree/master) | ||
|
||
Develop : | ||
* [![Melpa Status](https://melpa.org/packages/phpunit-badge.svg)](https://melpa.org/#/phpunit) | ||
* [![Circle CI](https://circleci.com/gh/nlamirault/phpunit.el/tree/develop.svg?style=svg)](https://circleci.com/gh/nlamirault/phpunit.el/tree/develop) | ||
* Master [![MELPA Stable](https://stable.melpa.org/packages/phpunit-badge.svg)](https://stable.melpa.org/#/phpunit) [![Circle CI](https://circleci.com/gh/nlamirault/phpunit.el/tree/master.svg?style=svg)](https://circleci.com/gh/nlamirault/phpunit.el/tree/master) [![Coverage Status](https://coveralls.io/repos/nlamirault/phpunit.el/badge.png)](https://coveralls.io/r/nlamirault/phpunit.el) | ||
* Develop : [![Melpa Status](https://melpa.org/packages/phpunit-badge.svg)](https://melpa.org/#/phpunit) [![Circle CI](https://circleci.com/gh/nlamirault/phpunit.el/tree/develop.svg?style=svg)](https://circleci.com/gh/nlamirault/phpunit.el/tree/develop) [![Coverage Status](https://coveralls.io/repos/github/nlamirault/phpunit.el/badge.svg?branch=develop)](https://coveralls.io/github/nlamirault/phpunit.el?branch=develop) | ||
|
||
Manage the [PHPUnit][] tests from Emacs (>= 24.3) | ||
|
||
|
@@ -70,12 +64,30 @@ management. Install it and retrieve dependencies : | |
$ export PATH="$HOME/.cask/bin:$PATH" | ||
$ cask | ||
|
||
### Testing | ||
|
||
* Launch unit tests from shell | ||
|
||
$ make clean test | ||
|
||
* Using [overseer][] : | ||
|
||
Keybinding | Description | ||
---------------------|------------------------------------------------------------ | ||
<kbd>C-c , t</kbd> | launch unit tests from buffer | ||
<kbd>C-c , b</kbd> | launch unit tests | ||
<kbd>C-c , g</kbd> | launch unit tests with tag (find, regexp, ...) | ||
|
||
* Tips: | ||
|
||
### Tests | ||
If you want to launch a single unit test, add a specify tag : | ||
|
||
Launch unit tests : | ||
```lisp | ||
(ert-deftest test-foobar () | ||
:tags '(current) | ||
``` | ||
|
||
$ make clean test | ||
And launch it using : <kbd>C-c , g</kbd> and specify tag : *current* | ||
|
||
|
||
## Support / Contribute | ||
|
@@ -101,9 +113,11 @@ Nicolas Lamirault <[email protected]> | |
|
||
[badge-license]: https://img.shields.io/badge/license-GPL_2-green.svg?style=flat | ||
[LICENSE]: https://github.com/nlamirault/phpunit.el/blob/master/LICENSE | ||
[Issue tracker]: https://github.com/nlamirault/phpunit.el/issues | ||
|
||
[PHPUnit]: http://phpunit.de | ||
|
||
[GNU Emacs]: https://www.gnu.org/software/emacs/ | ||
[MELPA]: https://melpa.org/ | ||
[Cask]: http://cask.github.io/ | ||
[Issue tracker]: https://github.com/nlamirault/phpunit.el/issues | ||
[PHPUnit]: http://phpunit.de | ||
[Overseer]: https://github.com/tonini/overseer.el |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
;;; phpunit-mode.el --- Minor mode for PHPUnit | ||
|
||
;; Copyright (C) 2014-2016 Nicolas Lamirault <[email protected]> | ||
|
||
;; 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 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,14 @@ | |
;; Eric Hansen <[email protected]> | ||
;; | ||
;; URL: https://github.com/nlamirault/phpunit.el | ||
;; Version: 0.11.0 | ||
;; Version: 0.12.0 | ||
;; Keywords: php, tests, phpunit | ||
|
||
;; Package-Requires: ((s "1.9.0") (f "0.16.0") (pkg-info "0.5") (cl-lib "0.5") (emacs "24.3")) | ||
|
||
;;; License: | ||
|
||
;; Copyright (C) 2014, 2015, 2016 Nicolas Lamirault <[email protected]> | ||
;; Copyright (C) 2014-2016 Nicolas Lamirault <[email protected]> | ||
|
||
;; This program is free software; you can redistribute it and/or | ||
;; modify it under the terms of the GNU General Public License | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
;;; phpunit-test.el --- Tests for phpunit.el | ||
|
||
;; Copyright (C) 2014, 2015, 2016 Nicolas Lamirault <[email protected]> | ||
;; Copyright (C) 2014-2016 Nicolas Lamirault <[email protected]> | ||
|
||
;;; Commentary: | ||
|
||
|
@@ -30,30 +30,33 @@ | |
;; (require 'phpunit) | ||
|
||
|
||
(defun phpunit-command (&rest arg) | ||
(let ((composer-dir (s-concat (concat (getenv "HOME") "/") ".composer")) | ||
(conf (if phpunit-configuration-file | ||
(s-concat "-c " phpunit-configuration-file " ") | ||
""))) | ||
(if (f-dir? composer-dir) | ||
(apply 's-concat composer-dir "/vendor/bin/phpunit " conf arg) | ||
(apply 's-concat "./vendor/bin/phpunit " conf arg)))) | ||
;; (defun phpunit-command (&rest arg) | ||
;; (let ((composer-dir (s-concat (concat (getenv "HOME") "/") ".composer")) | ||
;; (conf (if phpunit-configuration-file | ||
;; (s-concat "-c " phpunit-configuration-file " ") | ||
;; ""))) | ||
;; (if (f-dir? composer-dir) | ||
;; (apply 's-concat composer-dir "/vendor/bin/phpunit " conf arg) | ||
;; (apply 's-concat "./vendor/bin/phpunit " conf arg)))) | ||
|
||
|
||
(ert-deftest test-phpunit-get-class-from-file-path() | ||
:tags '(tools) | ||
(should (string= "PhpUnitTest" | ||
(phpunit-get-current-class "/tmp/foo/PhpUnit.class.under.test.php")))) | ||
(with-test-sandbox | ||
(should (string= "PhpUnitTest" | ||
(phpunit-get-current-class "/tmp/foo/PhpUnit.class.under.test.php"))))) | ||
|
||
(ert-deftest test-phpunit-get-class-from-source-class() | ||
:tags '(tools) | ||
(should (string= "PhpUnitTest" | ||
(phpunit-get-current-class "PhpUnit")))) | ||
:tags '(tools) | ||
(with-test-sandbox | ||
(should (string= "PhpUnitTest" | ||
(phpunit-get-current-class "PhpUnit"))))) | ||
|
||
(ert-deftest test-phpunit-get-class-from-unit-test-class() | ||
:tags '(tools) | ||
(should (string= "PhpUnitTest" | ||
(phpunit-get-current-class "PhpUnitTest")))) | ||
:tags '(tools) | ||
(with-test-sandbox | ||
(should (string= "PhpUnitTest" | ||
(phpunit-get-current-class "PhpUnitTest"))))) | ||
|
||
|
||
;; Using configuration file | ||
|
@@ -76,36 +79,37 @@ | |
(ert-deftest test-phpunit-get-program-without-args () | ||
:tags '(arguments) | ||
(with-test-sandbox | ||
(should (string= (phpunit-command) | ||
(phpunit-get-program (phpunit-arguments "")))))) | ||
(should (s-suffix? "phpunit " | ||
(phpunit-get-program (phpunit-arguments "")))))) | ||
|
||
(ert-deftest test-phpunit-add-stop-on-error-argument () | ||
:tags '(arguments) | ||
:tags '(arguments current) | ||
(with-test-sandbox | ||
(let ((phpunit-stop-on-error t)) | ||
(should (s-suffix? (phpunit-command " --stop-on-error") | ||
(phpunit-get-program (phpunit-arguments ""))))))) | ||
(message "==> %s " (phpunit-get-program (phpunit-arguments ""))) | ||
(should (s-suffix? "phpunit --stop-on-error" | ||
(phpunit-get-program (phpunit-arguments ""))))))) | ||
|
||
(ert-deftest test-phpunit-add-stop-on-failure-argument () | ||
:tags '(arguments) | ||
(with-test-sandbox | ||
(let ((phpunit-stop-on-failure t)) | ||
(should (s-suffix? (phpunit-command " --stop-on-failure") | ||
(phpunit-get-program (phpunit-arguments ""))))))) | ||
(should (s-suffix? "phpunit --stop-on-failure" | ||
(phpunit-get-program (phpunit-arguments ""))))))) | ||
|
||
(ert-deftest test-phpunit-add-stop-on-skipped-argument () | ||
:tags '(arguments) | ||
(with-test-sandbox | ||
(let ((phpunit-stop-on-skipped t)) | ||
(should (s-suffix? (phpunit-command " --stop-on-skipped") | ||
(phpunit-get-program (phpunit-arguments ""))))))) | ||
(should (s-suffix? "phpunit --stop-on-skipped" | ||
(phpunit-get-program (phpunit-arguments ""))))))) | ||
|
||
(ert-deftest test-phpunit-add-verbose-argument () | ||
:tags '(arguments) | ||
(with-test-sandbox | ||
(let ((phpunit-verbose-mode t)) | ||
(should (s-suffix? (phpunit-command " --verbose") | ||
(phpunit-get-program (phpunit-arguments ""))))))) | ||
(should (s-suffix? "phpunit --verbose" | ||
(phpunit-get-program (phpunit-arguments ""))))))) | ||
|
||
|
||
(provide 'phpunit-test) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
;;; phpunit-version-test.el --- Tests for version information | ||
|
||
;; Copyright (C) 2014, 2015, 2016 Nicolas Lamirault <[email protected]> | ||
;; Copyright (C) 2014-2016 Nicolas Lamirault <[email protected]> | ||
|
||
;;; Commentary: | ||
|
||
|
@@ -37,7 +37,7 @@ | |
;;(message "PHPUnit.el : %s" lib-version) | ||
(message "PHPUnit.el Cask version: %s" cask-version) | ||
;;(should (string= version (phpunit-mode-library-version))))) | ||
(should (string= "0.11.0" cask-version)))) | ||
(should (string= "0.12.0" cask-version)))) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
;; test-helper.el --- Test helpers for Phpunit.el | ||
|
||
;; Copyright (C) 2014, 2015, 2016 Nicolas Lamirault <[email protected]> | ||
;; Copyright (C) 2014-2016 Nicolas Lamirault <[email protected]> | ||
|
||
;; Author: Nicolas Lamirault <[email protected]> | ||
;; Homepage: https://github.com/nlamirault/phpunit.el | ||
|
@@ -73,7 +73,7 @@ | |
(defun load-library (file) | ||
"Load current library from FILE." | ||
(let ((path (s-concat phpunit-source-dir file))) | ||
(message (ansi-yellow "[gotest] Load library from %s" path)) | ||
(message (ansi-yellow "[phpunit] Load library from %s" path)) | ||
(undercover "*.el" (:exclude "*-test.el")) | ||
(require 'phpunit path))) | ||
|
||
|