Skip to content

Commit f2727ff

Browse files
committed
feat: adding pest
1 parent 3a405a6 commit f2727ff

File tree

10 files changed

+482
-29
lines changed

10 files changed

+482
-29
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
tools: composer:v2
3333
coverage: none
3434

35+
- name: Setup problem matchers
36+
run: |
37+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
38+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
39+
3540
- name: Load cached dependencies
3641
id: cached-composer-dependencies
3742
uses: actions/cache@v3
@@ -46,10 +51,12 @@ jobs:
4651
- name: Run coding standards task
4752
run: make cs-diff
4853

49-
- name: Execute phpunit tests
54+
- name: Execute phpunit and pest tests
5055
run: make test
5156

5257
- name: Run static analysis using phpstan
5358
run: make stan
59+
env:
60+
PHPSTAN_OUTPUT_FORMAT: github
5461

5562
...

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ endif
3232
MAKE_LOGFILE = /tmp/wayofdev-php-package-tpl.log
3333
MAKE_CMD_COLOR := $(BLUE)
3434

35+
# https://phpstan.org/user-guide/output-format
36+
export PHPSTAN_OUTPUT_FORMAT ?= table
37+
3538
help:
3639
@echo 'Management commands for package:'
3740
@echo 'Usage:'
@@ -73,15 +76,15 @@ cs-fix: prepare ## Fixes code to follow coding standards using php-cs-fixer
7376
.PHONY: cs-fix
7477

7578
stan: ## Runs phpstan – static analysis tool
76-
$(COMPOSER_RUN) stan
79+
$(COMPOSER_RUN) stan --error-format=$(PHPSTAN_OUTPUT_FORMAT)
7780
.PHONY: stan
7881

79-
test: ## Run project php-unit tests
82+
test: ## Run project php-unit and pest tests
8083
$(COMPOSER_RUN) test
8184
.PHONY: test
8285

83-
test-cc: ## Run project php-unit tests in coverage mode and build report
84-
XDEBUG_MODE="coverage" $(COMPOSER_RUN) test-cc
86+
test-cc: ## Run project php-unit and pest tests in coverage mode and build report
87+
$(COMPOSER_RUN) test-cc
8588
.PHONY: test-cc
8689

8790
# Yaml Actions

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"require-dev": {
2121
"ergebnis/composer-normalize": "^2.28",
22+
"pestphp/pest": "^1.21",
2223
"phpstan/extension-installer": "^1.1",
2324
"phpstan/phpstan": "^1.8",
2425
"phpstan/phpstan-deprecation-rules": "^1.0",
@@ -30,26 +31,27 @@
3031
},
3132
"autoload": {
3233
"psr-4": {
33-
"WayOfDev\\PackageTpl\\": "src/"
34+
"WayOfDev\\Package\\": "src/"
3435
}
3536
},
3637
"autoload-dev": {
3738
"psr-4": {
38-
"WayOfDev\\PackageTpl\\Tests\\": "tests/"
39+
"WayOfDev\\Package\\Tests\\": "tests/"
3940
}
4041
},
4142
"scripts": {
4243
"cs-fix": "php vendor/bin/php-cs-fixer fix -v",
4344
"cs-diff": "php vendor/bin/php-cs-fixer fix --dry-run -v --diff",
44-
"test": "php vendor/bin/phpunit",
45-
"test-cc": "php vendor/bin/phpunit --coverage-text --colors=never",
45+
"test": "php vendor/bin/pest",
46+
"test-cc": "php vendor/bin/pest --coverage",
4647
"stan": "php vendor/bin/phpstan analyse"
4748
},
4849
"config": {
4950
"sort-packages": true,
5051
"allow-plugins": {
5152
"ergebnis/composer-normalize": true,
52-
"phpstan/extension-installer": true
53+
"phpstan/extension-installer": true,
54+
"pestphp/pest-plugin": true
5355
}
5456
},
5557
"extra": {

0 commit comments

Comments
 (0)