Skip to content

Instantly share code, notes, and snippets.

@fhuitelec
Last active January 3, 2018 15:06
Show Gist options
  • Save fhuitelec/6c0ffd1bd1b0f8281bce449c975b54b5 to your computer and use it in GitHub Desktop.
Save fhuitelec/6c0ffd1bd1b0f8281bce449c975b54b5 to your computer and use it in GitHub Desktop.
[Bootstrap PHPUnit] #docker #php #unittests #makefile
# ######### #
# VARIABLES #
# ######### #
export PHP_VERSION = 7.1
export PROJECT_NAME = your-project-name
# ####### #
# TARGETS #
# ####### #
.PHONY: unit
unit:
$(MAKE) .inner-tests TEST_SUITE=unit
.PHONY: functional
functional:
$(MAKE) .inner-tests TEST_SUITE=functional
.PHONY: tests
tests: unit functional
.PHONY: .inner-tests
.inner-tests:
ifdef FILTER
$(DOCKER_EXEC) php:${PHP_VERSION}-cli-alpine ./vendor/bin/phpunit --testsuite $(TEST_SUITE) --filter "$(FILTER)"
else
$(DOCKER_EXEC) php:${PHP_VERSION}-cli-alpine ./vendor/bin/phpunit --testsuite $(TEST_SUITE)
endif
@echo
@echo 'Test documentation available at: ' ${PWD}/var/tests/documentation/testdox.html
# ######### #
# INTERNALS #
# ######### #
# Docker partial commands
export COMPOSER_COMPOSE_EXEC = docker-compose -f infrastructure/dev/composer.docker-compose.yaml
export DOCKER_EXEC = docker run -ti --rm --name ${PROJECT_NAME} --volume ${PWD}:/app --workdir /app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment