Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cask
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@

(development
(depends-on "ecukes")
(depends-on "ert-runner")
(depends-on "f"))
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ CASK=cask

.PHONY: test test-simple elc package clean

test-simple:
test-unit:
$(CASK) exec ert-runner

test-functional:
$(CASK) exec ecukes

test-all:
$(MAKE) test-unit
$(MAKE) test-functional

test:
$(MAKE) clean
$(MAKE) test-simple
$(MAKE) test-all
$(MAKE) elc
$(MAKE) test-simple
$(MAKE) test-all

elc:
$(CASK) build
Expand Down
8 changes: 4 additions & 4 deletions ede-php-autoload-composer.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; ede-php-autoload-composer.el --- Composer projects detection and analysis -*- lexical-binding: t -*-

;; Copyright (C) 2015, Steven Rémot
;; Copyright (C) 2015, 2017, Steven Rémot

;; Author: Steven Rémot <steven.remot@gmail.com>
;; Keywords: PHP project ede
Expand Down Expand Up @@ -164,7 +164,7 @@ NEW-AUTOLOADS will be merged into BASE-AUTOLOADS. BASE-AUTOLOADS will be mutate

autoloads))

(defun ede-php-autoload--merge-composer-autoloads (composer-data autoloads &optional base-dir)
(defun ede-php-autoload-composer-merge-composer-autoloads (composer-data autoloads &optional base-dir)
"Load the autoload information in COMPOSER-DATA and merge it with AUTOLOADS.

COMPOSER-DATA is the parsed composer.json file.
Expand Down Expand Up @@ -249,7 +249,7 @@ Returns the new list of autoloads."

CONTEXT is the composer context.
AUTOLOADS is the current list of autoloads."
(ede-php-autoload--merge-composer-autoloads (ede-php-autoload-composer-get-composer-data context) autoloads nil))
(ede-php-autoload-composer-merge-composer-autoloads (ede-php-autoload-composer-get-composer-data context) autoloads nil))

(ede-php-autoload-composer-define-visitor #'ede-php-autoload-composer--merge-composer-data-autoloads)

Expand All @@ -267,7 +267,7 @@ AUTOLOADS is the current list of autoloads."
current-data)
(while (< i l)
(setq current-data (aref third-party-data i)
autoloads (ede-php-autoload--merge-composer-autoloads
autoloads (ede-php-autoload-composer-merge-composer-autoloads
current-data
autoloads
(ede-php-autoload-composer--get-third-party-dir current-data vendor-dir))
Expand Down
45 changes: 45 additions & 0 deletions test/ede-php-autoload-composer-test.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
;;; ede-php-autoload-composer-test.el --- Unit test for ede-php-autoload-composer

;;; Commentary:
;;
;; Copyright (C) 2017, Steven Rémot

;; Author: Steven Rémot <steven.remot@gmail.com>
;; Keywords: PHP project ede
;; Homepage: https://github.com/stevenremot/ede-php-autoload

;; 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 2, 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; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Code:

(ert-deftest ede-php-autoload-composer-merge-autoloads-concats-files ()
"`ede-php-autoload-composer-merge-autoloads' should concat provided autoloads."
(should (equal

(ede-php-autoload-composer-merge-autoloads
'(:psr-0 (("Test" . "test/")) :psr-4 (("Test3" . "test3/")))
'(:psr-0 (("Test2" . "test2/")) :psr-4 (("Test4" . "test4/"))))

'(:psr-0 (("Test" . "test/")
("Test2" . "test2/"))
:psr-4 (("Test3" . "test3/")
("Test4" . "test4/"))))))

(provide 'ede-php-autoload-composer-test)

;;; ede-php-autoload-composer-test.el ends here
38 changes: 38 additions & 0 deletions test/test-helper.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
;;; test-helper.el --- Unit test bootstrap

;;; Commentary:
;;
;; Copyright (C) 2017, Steven Rémot

;; Author: Steven Rémot <steven.remot@gmail.com>
;; Keywords: PHP project ede
;; Homepage: https://github.com/stevenremot/ede-php-autoload

;; 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 2, 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; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Code:

(add-to-list 'load-path (concat (file-name-directory (or load-file-name buffer-file-name)) "/.."))
(message (concat (or load-file-name buffer-file-name) "/.."))

(require 'ert)
(require 'ede-php-autoload)

(provide 'test-helper)

;;; test-helper.el ends here