Skip to content

Commit

Permalink
Merge pull request #27 from nlamirault/develop
Browse files Browse the repository at this point in the history
Release 0.12.0
  • Loading branch information
nlamirault authored Aug 8, 2016
2 parents 88bbeb9 + 3ce694a commit 165ca25
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 61 deletions.
15 changes: 15 additions & 0 deletions Cask
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/")
Expand Down
33 changes: 20 additions & 13 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,56 @@
# phpunit.el ChangeLog

## Version 0.12.0 (08/08/2016)

- `FIX` unit tests if *phpunit* executable exists.
- `FIX` Unit tests launcher using *overseer*
- Update documentation for unit testing
- Setup code coverage badges for *master* and *develop* branches

## Version 0.11.0 (08/08/2016)

- #PR25: Add phpunit-group (Thanks zonuexe)
- [#25](https://github.com/nlamirault/phpunit.el/pull/25): Add phpunit-group (Thanks zonuexe)

## Version 0.10.0 (08/07/2016)

- #PR23: Better regexp using rx (Thanks zonuexe)
- #PR22: Simplify phpunit-current-class (Thanks zonuexe)
- #PR21: Fix for Emacs 25.1 (Thanks zonuexe)
- [#23](https://github.com/nlamirault/phpunit.el/pull/23): Better regexp using rx (Thanks zonuexe)
- [#22](https://github.com/nlamirault/phpunit.el/pull/22): Simplify phpunit-current-class (Thanks zonuexe)
- [#21](https://github.com/nlamirault/phpunit.el/pull/21): Fix for Emacs 25.1 (Thanks zonuexe)

## Version 0.9.0 (05/31/2016)

- #PR19: Some problem fixes (Tramp, phpunit-get-root-directory,
- [#19](https://github.com/nlamirault/phpunit.el/pull/19): Some problem fixes (Tramp, phpunit-get-root-directory,
Use phpunit -c option when set configuration file, ...) (thanks zonuexe)
- Remove keybinding from phpunit-helm

## Version 0.8.0 (05/12/2016)

- #PR16: Create a minor mode (thanks eric-hansen)
- #PR12: Using the phpunit installed by Composer (thanks wangchen)
- [#16](https://github.com/nlamirault/phpunit.el/pull/16): Create a minor mode (thanks eric-hansen)
- [#12](https://github.com/nlamirault/phpunit.el/pull/12): Using the phpunit installed by Composer (thanks wangchen)

## Version 0.7.0 (09/10/2015)

- #PR10: Set stty columns before running the phpunit command (Thanks Ryckes)
- [#10](https://github.com/nlamirault/phpunit.el/pull/10): Set stty columns before running the phpunit command (Thanks Ryckes)

## Version 0.6.0 (08/27/2015)

- #PR9: Exact Class Names and Naming Conventions (Thanks muddletoes)
- [#9](https://github.com/nlamirault/phpunit.el/pull/9): Exact Class Names and Naming Conventions (Thanks muddletoes)

## Version 0.5.0 (08/23/2015)

- #PR7 : `php-get-current-class` matches style convention (Thanks muddletoes)
- #PR5 : Add error navigation after a failed test (Thanks Ryckes)
- [#7](https://github.com/nlamirault/phpunit.el/pull/7) : `php-get-current-class` matches style convention (Thanks muddletoes)
- [#5](https://github.com/nlamirault/phpunit.el/pull/5) : Add error navigation after a failed test (Thanks Ryckes)

## Version 0.4.0 (03/02/2015)

- Update unit tests configuration for [overseer][]
- #PR4: Variables for phpunit's directory and filename (Ahmad N. Raja)
- [#4](https://github.com/nlamirault/phpunit.el/pull/4): Variables for phpunit's directory and filename (Ahmad N. Raja)
- Update [TravisCI][] and [Drone.io][] for continuous integration
- Add code coverage using [undercover][]

## Version 0.3.0 (10/24/2014)

- #PR2: Remove unnecessary "depends-on" from Cask
- [#2](https://github.com/nlamirault/phpunit.el/pull/2): Remove unnecessary "depends-on" from Cask
- `FIX` Add Package-Requires line to display dependencies
- Update documentation

Expand Down
2 changes: 1 addition & 1 deletion Makefile
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
Expand Down
40 changes: 27 additions & 13 deletions README.md
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)

Expand Down Expand Up @@ -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
Expand All @@ -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
2 changes: 2 additions & 0 deletions phpunit-mode.el
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
Expand Down
4 changes: 2 additions & 2 deletions phpunit.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 32 additions & 28 deletions test/phpunit-test.el
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:

Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/phpunit-version-test.el
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:

Expand Down Expand Up @@ -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))))



Expand Down
4 changes: 2 additions & 2 deletions test/test-helper.el
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
Expand Down Expand Up @@ -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)))

Expand Down

0 comments on commit 165ca25

Please sign in to comment.