Skip to content

Commit 01dffd8

Browse files
committed
Enhancement: Use phpunit/phpunit to run tests
1 parent b95f3e7 commit 01dffd8

File tree

7 files changed

+1704
-4330
lines changed

7 files changed

+1704
-4330
lines changed

.github/workflows/integrate.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: "shivammathur/setup-php@v2"
2828
with:
2929
coverage: "none"
30-
extensions: "none, json, mbstring, tokenizer"
30+
extensions: "none, dom, json, mbstring, tokenizer, xmlwriter"
3131
php-version: "${{ matrix.php-version }}"
3232

3333
- name: "Set up problem matchers for PHP"
@@ -72,11 +72,27 @@ jobs:
7272
uses: "shivammathur/setup-php@v2"
7373
with:
7474
coverage: "none"
75-
extensions: "none"
75+
extensions: "none, dom, json, mbstring, tokenizer, xml, xmlwriter"
7676
php-version: "${{ matrix.php-version }}"
7777

7878
- name: "Set up problem matchers for PHP"
7979
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
8080

81-
- name: "Run tests"
82-
run: "php tests/run-tests.php -j3 -q --show-diff"
81+
- name: "Set up problem matchers for phpunit/phpunit"
82+
run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""
83+
84+
- name: "Determine composer cache directory"
85+
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV"
86+
87+
- name: "Cache dependencies installed with composer"
88+
uses: "actions/cache@v3"
89+
with:
90+
path: "${{ env.COMPOSER_CACHE_DIR }}"
91+
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
92+
restore-keys: "php-${{ matrix.php-version }}-composer-"
93+
94+
- name: "Install dependencies with composer"
95+
run: "composer install --ansi --no-interaction --no-progress"
96+
97+
- name: "Run phpunit/phpunit"
98+
run: "vendor/bin/phpunit --colors=always --configuration=tests/phpunit.xml"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/.build/
12
/vendor/
23

34
backend/mirror.gif

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
help: ## Displays this list of targets with descriptions
33
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
44

5+
.PHONY: code-coverage
6+
code-coverage: vendor ## Collects coverage from running tests with phpunit/phpunit
7+
vendor/bin/phpunit --configuration=tests/phpunit.xml --coverage-text
8+
59
.PHONY: coding-standards
610
coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fixer
711
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose
812

913
.PHONY: tests
10-
tests: ## Runs tests
11-
php tests/run-tests.php -j3 -q
14+
tests: vendor ## Runs tests with phpunit/phpunit
15+
vendor/bin/phpunit --configuration=tests/phpunit.xml
1216

1317
vendor: composer.json composer.lock
1418
composer validate --strict

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"php": "~8.2.0"
1212
},
1313
"require-dev": {
14-
"friendsofphp/php-cs-fixer": "^3.40.2"
14+
"friendsofphp/php-cs-fixer": "^3.40.2",
15+
"phpunit/phpunit": "^10.5.2"
1516
},
1617
"autoload": {
1718
"psr-4": {

0 commit comments

Comments
 (0)