From 53afc2f00dfc4c039542742a449f6af9b193d3d6 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 30 Sep 2025 12:32:21 +0800 Subject: [PATCH 1/2] Add composer commands --- TESTING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/TESTING.md b/TESTING.md index 59cf0fe..122d9a9 100644 --- a/TESTING.md +++ b/TESTING.md @@ -14,6 +14,19 @@ If you haven't yet set up your local development environment, refer to the [Setu If you haven't yet created a branch and made any code changes, refer to the [Development Guide](DEVELOPMENT.md) +### Familiar with PHP Coding Standards, PHPStan and PHPUnit? + +The following Composer commands can be used: + +| Command | Short Command | Description | +|---------|---------------|-------------| +| `composer php-coding-standards` | `composer phpcs` | Runs PHP Coding Standards on the `/src` folder | +| `composer fix-php-coding-standards` | `composer phpcbf` | Fix PHP files to meet PHP Coding Standards on the `/src` folder | +| `composer php-coding-standards-on-tests` | `composer phpcs-tests` | Runs PHP Coding Standards on the `/tests` folder | +| `composer fix-php-coding-standards-on-tests` | `composer phpcbf-tests` | Fix PHP files to meet PHP Coding Standards on the `/tests` folder | +| `composer static-analysis` | `composer phpstan` | Runs PHPStan static analysis with increased memory limit | +| `composer test` | `composer test` | Builds and runs WPUnit tests | + ## Write (or modify) a test If your work creates new functionality, write a test. From c1ed992aa9fdc9044e7449808e5eb887a6caad7e Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 30 Sep 2025 15:20:31 +0800 Subject: [PATCH 2/2] Add Composer Commands --- composer.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 30a377e..6082043 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,17 @@ "minimum-stability": "dev", "prefer-stable": true, "scripts": { - "create-docs": "phpDocumentor --directory=src --target=docs --template='vendor/saggre/phpdocumentor-markdown/themes/markdown'" + "create-docs": "phpDocumentor --directory=src --target=docs --template='vendor/saggre/phpdocumentor-markdown/themes/markdown'", + "phpcs": "vendor/bin/phpcs ./ -s -v", + "phpcbf": "vendor/bin/phpcbf ./ -s -v", + "phpcs-tests": "vendor/bin/phpcs ./tests --standard=phpcs.tests.xml -s -v", + "phpcbf-tests": "vendor/bin/phpcbf ./tests --standard=phpcs.tests.xml -s -v", + "phpstan": "vendor/bin/phpstan analyse --memory-limit=1250M", + "php-coding-standards": "vendor/bin/phpcs ./ -s -v", + "fix-php-coding-standards": "vendor/bin/phpcbf ./ -s -v", + "php-coding-standards-on-tests": "vendor/bin/phpcs ./tests --standard=phpcs.tests.xml -s -v", + "fix-php-coding-standards-on-tests": "vendor/bin/phpcbf ./tests --standard=phpcs.tests.xml -s -v", + "php-static-analysis": "vendor/bin/phpstan analyse --memory-limit=1250M", + "test": "vendor/bin/phpunit --verbose --stop-on-failure @additional_args" } }