diff --git a/Makefile b/Makefile index 20cb60d5..ded95489 100644 --- a/Makefile +++ b/Makefile @@ -30,13 +30,6 @@ tools_path=$(shell pwd)/tools acceptance_test_deps=vendor-bin/behat/vendor -# bin file definitions -PHPUNIT=php -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit" -PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit" -PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer -PHP_CODESNIFFER=vendor-bin/php_codesniffer/vendor/bin/phpcs -BEHAT_BIN=vendor-bin/behat/vendor/bin/behat - .DEFAULT_GOAL := help # start with displaying help @@ -73,37 +66,6 @@ clean: clean-deps $(clean_rules) .PHONY: test test: $(test_rules) - -## -## Tests -##-------------------------------------- - -.PHONY: test-php-unit -test-php-unit: ## Run php unit tests -test-php-unit: - $(PHPUNIT) --configuration ./phpunit.xml --testsuite unit - -.PHONY: test-php-unit-dbg -test-php-unit-dbg: ## Run php unit tests using phpdbg -test-php-unit-dbg: - $(PHPUNITDBG) --configuration ./phpunit.xml --testsuite unit - -.PHONY: test-php-style -test-php-style: ## Run php-cs-fixer and check owncloud code-style -test-php-style: vendor-bin/owncloud-codestyle/vendor vendor-bin/php_codesniffer/vendor - $(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes --dry-run - $(PHP_CODESNIFFER) --runtime-set ignore_warnings_on_exit --standard=phpcs.xml tests/acceptance - -.PHONY: test-php-style-fix -test-php-style-fix: ## Run php-cs-fixer and fix code style issues -test-php-style-fix: vendor-bin/owncloud-codestyle/vendor - $(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes - -.PHONY: test-acceptance-api -test-acceptance-api: ## Run API acceptance tests -test-acceptance-api: $(acceptance_test_deps) - BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type api - # # Dependency management #-------------------------------------- @@ -116,21 +78,3 @@ vendor: composer.lock vendor/bamarni/composer-bin-plugin: composer.lock composer install - -vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock - composer bin owncloud-codestyle install --no-progress - -vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json - @echo owncloud-codestyle composer.lock is not up to date. - -vendor-bin/php_codesniffer/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/php_codesniffer/composer.lock - composer bin php_codesniffer install --no-progress - -vendor-bin/php_codesniffer/composer.lock: vendor-bin/php_codesniffer/composer.json - @echo php_codesniffer composer.lock is not up to date. - -vendor-bin/behat/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/behat/composer.lock - composer bin behat install --no-progress - -vendor-bin/behat/composer.lock: vendor-bin/behat/composer.json - @echo behat composer.lock is not up to date. diff --git a/rules/tests.mk b/rules/tests.mk index 55fc3af6..0f915cc2 100644 --- a/rules/tests.mk +++ b/rules/tests.mk @@ -2,8 +2,14 @@ ## Tests ##-------------------------------------- +# bin file definitions KARMA=$(NODE_PREFIX)/node_modules/.bin/karma JSHINT=$(NODE_PREFIX)/node_modules/.bin/jshint +PHPUNIT=php -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit" +PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit" +PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer +PHP_CODESNIFFER=vendor-bin/php_codesniffer/vendor/bin/phpcs +BEHAT_BIN=vendor-bin/behat/vendor/bin/behat test_rules+=test-codecheck test-codecheck-deprecations test-js clean_rules+=clean-deps @@ -39,3 +45,50 @@ test-js-debug: $(js_deps) $(KARMA) js-templates test-syntax-js $(KARMA): $(nodejs_deps) $(JSHINT): $(nodejs_deps) +.PHONY: test-php-unit +test-php-unit: ## Run php unit tests +test-php-unit: + $(PHPUNIT) --configuration ./phpunit.xml --testsuite unit + +.PHONY: test-php-unit-dbg +test-php-unit-dbg: ## Run php unit tests using phpdbg +test-php-unit-dbg: + $(PHPUNITDBG) --configuration ./phpunit.xml --testsuite unit + +.PHONY: test-php-style +test-php-style: ## Run php-cs-fixer and check owncloud code-style +test-php-style: vendor-bin/owncloud-codestyle/vendor vendor-bin/php_codesniffer/vendor + $(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes --dry-run + $(PHP_CODESNIFFER) --runtime-set ignore_warnings_on_exit --standard=phpcs.xml tests/acceptance + +.PHONY: test-php-style-fix +test-php-style-fix: ## Run php-cs-fixer and fix code style issues +test-php-style-fix: vendor-bin/owncloud-codestyle/vendor + $(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes + +.PHONY: test-acceptance-api +test-acceptance-api: ## Run API acceptance tests +test-acceptance-api: $(acceptance_test_deps) + BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type api + +# +# Dependency management +#-------------------------------------- + +vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock + composer bin owncloud-codestyle install --no-progress + +vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json + @echo owncloud-codestyle composer.lock is not up to date. + +vendor-bin/php_codesniffer/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/php_codesniffer/composer.lock + composer bin php_codesniffer install --no-progress + +vendor-bin/php_codesniffer/composer.lock: vendor-bin/php_codesniffer/composer.json + @echo php_codesniffer composer.lock is not up to date. + +vendor-bin/behat/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/behat/composer.lock + composer bin behat install --no-progress + +vendor-bin/behat/composer.lock: vendor-bin/behat/composer.json + @echo behat composer.lock is not up to date.