Skip to content

[FEATURE] Add Composer scripts to run unit tests #503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,5 +633,17 @@ class Sabberworm\CSS\CSSList\Document#4 (2) {

## Misc

* Legacy Support: The latest pre-PSR-0 version of this project can be checked with the `0.9.0` tag.
* Running Tests: To run all unit tests for this project, run `composer install` to install phpunit and use `./vendor/bin/phpunit`.
### Legacy Support

The latest pre-PSR-0 version of this project can be checked with the `0.9.0` tag.

### Running Tests

To run all continuous integration (CI) checks for this project (including unit tests),
* run `composer install` to install the development dependencies managed with Composer;
* run `phive install` to install the development dependencies managed with PHIVE;
* [Installation of PHIVE](https://github.com/phar-io/phive?tab=readme-ov-file#getting-phive)
* run `composer ci` to run all static and dynamic CI checks.

Details of other Composer scripts available (e.g. to run one specific CI check) are provided with `composer list`.

17 changes: 15 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,38 @@
},
"scripts": {
"ci": [
"@ci:static"
"@ci:static",
"@ci:dynamic"
],
"ci:dynamic": [
"@ci:tests"
],
"ci:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix --dry-run -v --show-progress=dots --diff bin src tests",
"ci:php:stan": "phpstan --no-progress --configuration=config/phpstan.neon",
"ci:static": [
"@ci:php:fixer",
"@ci:php:stan"
],
"ci:tests": [
"@ci:tests:unit"
],
"ci:tests:sof": "\"./vendor/bin/phpunit\" --stop-on-failure --do-not-cache-result",
"ci:tests:unit": "\"./vendor/bin/phpunit\" --do-not-cache-result",
"fix:php": [
"@fix:php:fixer"
],
"fix:php:fixer": "\"./.phive/php-cs-fixer\" --config=config/php-cs-fixer.php fix bin src tests",
"phpstan:baseline": "phpstan --configuration=config/phpstan.neon --generate-baseline=config/phpstan-baseline.neon"
},
"scripts-descriptions": {
"ci": "Runs all dynamic and static code checks (i.e. currently, only the static checks).",
"ci": "Runs all dynamic and static code checks.",
"ci:dynamic": "Runs all dynamic code checks (i.e., currently, the unit tests).",
"ci:php:fixer": "Checks the code style with PHP CS Fixer.",
"ci:php:stan": "Checks the types with PHPStan.",
"ci:static": "Runs all static code analysis checks for the code.",
"ci:tests": "Runs all dynamic tests (i.e., currently, the unit tests).",
"ci:tests:sof": "Runs the unit tests and stops at the first failure.",
"ci:tests:unit": "Runs all unit tests.",
"fix:php": "Autofixes all autofixable issues in the PHP code.",
"fix:php:fixer": "Fixes autofixable issues found by PHP CS Fixer.",
"phpstan:baseline": "Updates the PHPStan baseline file to match the code."
Expand Down