Skip to content

Commit 736037b

Browse files
author
Alcides Ramos
committed
feat(Makefile): added support to filter tests
1 parent 895b584 commit 736037b

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ endif
2828

2929
#---
3030

31+
RANDOM_SEED := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ")
32+
33+
#---
34+
3135
COMPOSER_FLAGS_ANSI_PROFILE = --ansi --profile
3236
COMPOSER_FLAGS_OPTIMIZE_WITH_ALL_DEPS = --optimize-autoloader --with-all-dependencies
3337

@@ -127,15 +131,12 @@ phpstan: ## QA: <composer phpstan>
127131

128132
.PHONY: tests
129133
tests: ## QA: <composer tests>
130-
@composer tests
134+
@$(eval testsuite ?= 'Unit')
135+
@$(eval filter ?= '.')
136+
@php -d xdebug.mode=off vendor/bin/phpunit --configuration=phpunit.xml --testdox --colors --order-by=random --random-order-seed=$(RANDOM_SEED) --testsuite=$(testsuite) --filter=$(filter)
131137
$(call taskDone)
132138

133139
.PHONY: coverage
134140
coverage: ## QA: <composer coverage>
135141
@composer coverage
136142
$(call taskDone)
137-
138-
.PHONY: clean-cache
139-
clean-cache: ## QA: <composer clean-cache>
140-
@composer clean-cache
141-
$(call taskDone)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"phpcs": "phpcs -p --colors --standard=phpcs.xml app/ tests/",
4545
"phpcbf": "phpcbf -p --colors --standard=phpcs.xml app/ tests/",
4646
"phpstan": "phpstan analyse --ansi --configuration=phpstan.neon --memory-limit=1G --no-progress",
47-
"phpunit": "phpunit --configuration=phpunit.xml --testdox --colors --order-by=random --random-order-seed=$(head -200 /dev/urandom | cksum | cut -f1 -d \" \")",
47+
"phpunit": "php -d xdebug.mode=off phpunit --configuration=phpunit.xml --testdox --colors --order-by=random --random-order-seed=$(head -200 /dev/urandom | cksum | cut -f1 -d \" \")",
4848

4949
"tests": [
5050
"@linter",

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
failOnRisky="true"
1111
failOnWarning="true">
1212
<testsuites>
13-
<testsuite name="Unit Tests">
13+
<testsuite name="Unit">
1414
<directory suffix=".php">tests/Unit</directory>
1515
</testsuite>
1616
</testsuites>

0 commit comments

Comments
 (0)