Skip to content

Commit a303911

Browse files
author
Alcides Ramos
committed
feat: minor improvements
1 parent 4756091 commit a303911

3 files changed

Lines changed: 33 additions & 23 deletions

File tree

Makefile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ endif
2929
#---
3030

3131
RANDOM_SEED := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ")
32+
PHPUNIT = php -d xdebug.mode=off vendor/bin/phpunit --configuration=phpunit.xml --testdox --colors --order-by=random --random-order-seed=$(RANDOM_SEED)
3233

3334
#---
3435

@@ -82,7 +83,7 @@ composer-dump: ## Application: <composer dump-auto>
8283

8384
.PHONY: composer-install
8485
composer-install: ## Application: <composer install>
85-
@composer install $(COMPOSER_FLAGS_ANSI_PROFILE) --no-interaction --optimize-autoloader --audit
86+
@composer config --global discard-changes true && composer install $(COMPOSER_FLAGS_ANSI_PROFILE) --no-interaction --optimize-autoloader --audit
8687
$(call taskDone)
8788

8889
.PHONY: composer-remove
@@ -111,29 +112,39 @@ composer-update: ## Application: <composer update>
111112

112113
.PHONY: linter
113114
linter: ## QA: <composer linter>
114-
@composer linter
115+
@$(eval filter ?= 'app')
116+
@composer linter $(filter)
115117
$(call taskDone)
116118

117119
.PHONY: phpcs
118120
phpcs: ## QA: <composer phpcbs>
119-
@composer phpcs
121+
@$(eval filter ?= 'app')
122+
@composer phpcs $(filter)
120123
$(call taskDone)
121124

122125
.PHONY: phpcbf
123126
phpcbf: ## QA: <composer phpcbf>
124-
@composer phpcbf
127+
@$(eval filter ?= 'app')
128+
@composer phpcbf $(filter)
125129
$(call taskDone)
126130

127131
.PHONY: phpstan
128132
phpstan: ## QA: <composer phpstan>
129-
@composer phpstan
133+
@$(eval filter ?= 'app')
134+
@composer phpstan $(filter)
130135
$(call taskDone)
131136

132137
.PHONY: tests
133138
tests: ## QA: <composer tests>
134139
@$(eval testsuite ?= 'Unit')
135140
@$(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)
141+
@$(PHPUNIT) --testsuite=$(testsuite) --filter=$(filter)
142+
$(call taskDone)
143+
144+
.PHONY: tests-unit
145+
tests-unit: ## QA: <composer tests-unit>
146+
@$(eval filter ?= '.')
147+
@$(PHPUNIT) --testsuite=Unit --filter=$(filter)
137148
$(call taskDone)
138149

139150
.PHONY: coverage

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ Additionally a *Makefile* is provided with frequently used commands:
103103
· phpcbf QA: <composer phpcbf>
104104
· phpstan QA: <composer phpstan>
105105
· tests QA: <composer tests>
106+
· tests-unit QA: <composer tests-unit>
106107
· coverage QA: <composer coverage>
107108
```
108109

109-
110110
> [!NOTE]
111111
>
112112
> This file is really useful when you create a container with a project based on this repository and you want to run those commands from outside the container, directly from your *host*. To do so just copy and paste the included steps on your main *Makefile* and adjust the constants accordingly.
@@ -122,19 +122,13 @@ $ make composer-install
122122
###### Default command
123123

124124
```bash
125-
$ make tests
126-
```
127-
128-
###### Run only Unit testsuite
129-
130-
```bash
131-
$ make tests testsuite=Unit
125+
$ make tests [filter="checkInvokeMethod tests/Unit/Providers/FooTest.php"]
132126
```
133127

134-
###### Filter a specific test
128+
###### Run only Unit testsuite
135129

136130
```bash
137-
$ make tests filter="checkInvokeMethod tests/Unit/Providers/FooTest.php"
131+
$ make tests-unit [filter="checkInvokeMethod tests/Unit/Providers/FooTest.php"]
138132
```
139133

140134
#### Volumes

composer.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,26 @@
4040
"symfony/var-dumper": "^7.0"
4141
},
4242
"scripts": {
43-
"linter": "parallel-lint --colors -e php -j 10 app/ tests/",
44-
"phpcs": "phpcs -p --colors --standard=phpcs.xml app/ tests/",
45-
"phpcbf": "phpcbf -p --colors --standard=phpcs.xml app/ tests/",
46-
"phpstan": "phpstan analyse --ansi --configuration=phpstan.neon --memory-limit=1G --no-progress",
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 \" \")",
43+
"linter": "vendor/bin/parallel-lint --colors -e php -j 10",
44+
"phpcs": "vendor/bin/phpcs -p --colors --standard=phpcs.xml",
45+
"phpcbf": "vendor/bin/phpcbf -p --colors --standard=phpcs.xml",
46+
"phpstan": "vendor/bin/phpstan analyse --ansi --memory-limit=1G --no-progress --configuration=phpstan.neon",
47+
"phpunit": "php -d xdebug.mode=off vendor/bin/phpunit --configuration=phpunit.xml --testdox --colors --order-by=random --random-order-seed=$(head -200 /dev/urandom | cksum | cut -f1 -d \" \")",
4848

4949
"tests": [
50-
"@linter",
50+
"@linter app/ tests/",
5151
"@phpcs",
5252
"@phpunit --coverage-text"
5353
],
54+
"tests-unit": [
55+
"@linter app/ tests/",
56+
"@phpcs",
57+
"@phpunit --testsuite=Unit --coverage-text"
58+
],
5459

5560
"coverage": [
5661
"rm -Rf /coverage/*",
57-
"@linter",
62+
"@linter app/ tests/",
5863
"@phpcs",
5964
"@phpunit --coverage-text --coverage-html=/coverage"
6065
]

0 commit comments

Comments
 (0)