Skip to content

Commit 52251a8

Browse files
dev: Upgrade to PHPUnit 11
1 parent 95be14a commit 52251a8

8 files changed

+368
-411
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/coverage
22
/vendor
3+
/.phpunit.result.cache
34

45
/.env
56

.phpunit.xml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
4+
<phpunit
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
7+
bootstrap="tests/bootstrap.php"
8+
colors="true"
9+
displayDetailsOnIncompleteTests="true"
10+
displayDetailsOnSkippedTests="true"
11+
displayDetailsOnTestsThatTriggerDeprecations="true"
12+
displayDetailsOnTestsThatTriggerErrors="true"
13+
displayDetailsOnTestsThatTriggerNotices="true"
14+
displayDetailsOnTestsThatTriggerWarnings="true"
15+
displayDetailsOnPhpunitDeprecations="true"
16+
failOnDeprecation="true"
17+
failOnEmptyTestSuite="true"
18+
failOnIncomplete="true"
19+
failOnRisky="true"
20+
failOnSkipped="true"
21+
failOnWarning="true"
22+
testdox="true"
23+
testdoxSummary="true"
24+
>
25+
<php>
26+
<ini name="display_errors" value="1" />
27+
<ini name="error_reporting" value="-1" />
28+
<server name="APP_ENV" value="test" force="true" />
29+
<server name="SHELL_VERBOSITY" value="-1" />
30+
</php>
31+
32+
<testsuites>
33+
<testsuite name="Test Suite">
34+
<directory>tests</directory>
35+
</testsuite>
36+
</testsuites>
37+
38+
<source>
39+
<include>
40+
<directory suffix=".php">src</directory>
41+
</include>
42+
</source>
43+
</phpunit>

Makefile

+7-23
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,6 @@ else
1212
COMPOSER = ./docker/bin/composer
1313
endif
1414

15-
ifndef COVERAGE
16-
COVERAGE = --coverage-html ./coverage
17-
endif
18-
19-
ifdef FILTER
20-
PHPUNIT_FILTER = --filter=$(FILTER)
21-
else
22-
PHPUNIT_FILTER =
23-
endif
24-
25-
ifdef FILE
26-
PHPUNIT_FILE = $(FILE)
27-
else
28-
PHPUNIT_FILE = ./tests
29-
endif
30-
3115
.PHONY: docker-start
3216
docker-start: ## Start a development server
3317
@echo "Running webserver on http://localhost:8000"
@@ -50,13 +34,13 @@ setup: .env ## Initialize the application
5034
$(PHP) cli migrations setup --seed
5135

5236
.PHONY: test
53-
test: ## Run the tests suite
54-
XDEBUG_MODE=coverage $(PHP) ./vendor/bin/phpunit \
55-
$(COVERAGE) --whitelist ./src \
56-
--bootstrap ./tests/bootstrap.php \
57-
--testdox \
58-
$(PHPUNIT_FILTER) \
59-
$(PHPUNIT_FILE)
37+
test: FILE ?= ./tests
38+
ifdef FILTER
39+
test: override FILTER := --filter=$(FILTER)
40+
endif
41+
test: COVERAGE ?= --coverage-html ./coverage
42+
test: ## Run the test suite (can take FILE, FILTER and COVERAGE arguments)
43+
$(PHP) ./vendor/bin/phpunit -c .phpunit.xml $(COVERAGE) $(FILTER) $(FILE)
6044

6145
.PHONY: lint
6246
lint: ## Run the linters on the PHP files

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
"require-dev": {
88
"phpstan/phpstan": "^1.10",
9-
"phpunit/phpunit": "^9.5",
9+
"phpunit/phpunit": "^11.0",
1010
"squizlabs/php_codesniffer": "^3.6"
1111
},
1212

0 commit comments

Comments
 (0)