Skip to content

Commit b0ef15d

Browse files
authored
Merge pull request #834 from Kit/add-composer-scripts
Composer: Add Commands
2 parents f45128a + cac43b8 commit b0ef15d

4 files changed

Lines changed: 57 additions & 18 deletions

File tree

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# Build ACTIONS-FILTERS.md
2-
php create-actions-filters-docs.php
3-
4-
# Generate .pot file
5-
php -n $(which wp) i18n make-pot ../ ../languages/convertkit.pot
6-
71
# Remove vendor directory
82
cd ..
93
rm -rf vendor

DEPLOYMENT.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@ An *approved* Pull Request is when a PR passes all tests **and** has been approv
1212

1313
In your Git client / command line, create a new branch called `release-x.x.x`, where `x.x.x` is the version number.
1414

15-
## Generate Localization File and Action/Filter Documentation
16-
17-
On your local machine, switch to the new release branch.
18-
19-
Run the `.scripts/build.sh` script, which will:
20-
21-
- Generate the `languages/convertkit.pot` file
22-
- Generate the [ACTIONS-FILTERS.md](ACTIONS-FILTERS.md) file
23-
- Produce a `convertkit.zip` Plugin file, which may be used for any manual testing on other environments
24-
2515
## Update the Plugin's Version Number
2616

2717
We follow [Semantic Versioning](https://semver.org/).
@@ -44,6 +34,15 @@ what took place in this version.
4434

4535
Each line in the changelog should start with `Added`, `Fix` or `Updated`.
4636

37+
## Generate Localization File and Action/Filter Documentation
38+
39+
On your local machine, switch to the new release branch.
40+
41+
Run `composer create-release-assets`, which will:
42+
43+
- Generate the `languages/convertkit.pot` file
44+
- Generate the [ACTIONS-FILTERS.md](ACTIONS-FILTERS.md) file
45+
4746
## Commit Changes
4847

4948
Commit the updated files, which should comprise of:

TESTING.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ If you haven't yet set up your local development environment with the Kit Plugin
1616

1717
If you haven't yet created a branch and made any code changes to the Plugin, refer to the [Development Guide](DEVELOPMENT.md)
1818

19+
> **Familiar with wp-browser, Codeception, PHP Coding Standards and PHPStan?**
20+
> Write your tests
21+
> Run tests using `composer test [folder]/[cest]` or `composer test-integration [test]`
22+
> Run PHP Coding Standards using `composer phpcs` and `composer phpcs-tests`
23+
> Run static analysis using `composer phpstan`
24+
> [Submit a Pull Request](https://github.com/ConvertKit/convertkit-wordpress/compare).
25+
26+
##
27+
28+
- Write your tests
29+
- `composer test
30+
1931
## Write (or modify) a test
2032

2133
If your work creates new functionality, write a test.
@@ -377,6 +389,13 @@ To register your own helper function, add it to the `tests/Support/Helper/Wpunit
377389

378390
## Run Tests
379391

392+
> **Quick Commands**
393+
> `composer test`: Run all End to End tests
394+
> `composer test general`: Run all tests in the EndToEnd/general folder
395+
> `composer test general/ActivateDeactivatePluginCest`: Run all tests in the EndToEnd/general/ActivateDeactivatePluginCest file
396+
> `composer test-integration`: Run all Integration tests
397+
> `composer test-integration APITest`: Run the Integration/APITest tests
398+
380399
Once you have written your code and test(s), run the tests to make sure there are no errors.
381400

382401
If ChromeDriver isn't running, open a new Terminal window and enter the following command:
@@ -392,13 +411,15 @@ vendor/bin/codecept build
392411
vendor/bin/codecept run EndToEnd
393412
vendor/bin/codecept run Integration
394413
```
395-
396414
If a test fails, you can inspect the output and screenshot at `tests/_output`.
397415

398416
Any errors should be corrected by making applicable code or test changes.
399417

400418
## Run PHP CodeSniffer
401419

420+
> **Quick Command**
421+
> `composer phpcs`: Run PHP Coding Standards on Plugin files
422+
402423
[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) checks that all Plugin code meets the
403424
[WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/).
404425

@@ -428,6 +449,9 @@ Need to change the PHP or WordPress coding standard rules applied? Either:
428449

429450
## Run PHPStan
430451

452+
> **Quick Command**
453+
> `composer phpstan`: Run PHPStan static analysis on Plugin files
454+
431455
[PHPStan](https://phpstan.org) performs static analysis on the Plugin's PHP code. This ensures:
432456

433457
- DocBlocks declarations are valid and uniform
@@ -449,6 +473,9 @@ False positives [can be excluded by configuring](https://phpstan.org/user-guide/
449473

450474
## Run PHP CodeSniffer for Tests
451475

476+
> **Quick Command**
477+
> `composer phpcs-tests`: Run PHP Coding Standards on test files
478+
452479
In the Plugin's directory, run the following command to run PHP_CodeSniffer, which will check the code meets Coding Standards
453480
as defined in the `phpcs.tests.xml` configuration:
454481

composer.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "convertkit/convertkit-wordpress",
3-
"description": "ConvertKit WordPress Plugin",
3+
"description": "Kit WordPress Plugin",
44
"type": "project",
55
"license": "GPLv3",
66
"require": {
@@ -16,6 +16,25 @@
1616
},
1717
"minimum-stability": "dev",
1818
"prefer-stable": true,
19+
"scripts": {
20+
"create-release-assets": [
21+
"php -n $(which wp) i18n make-pot . languages/convertkit.pot",
22+
"@php .scripts/create-actions-filters-docs.php"
23+
],
24+
"create-pot": "php -n $(which wp) i18n make-pot . languages/convertkit.pot",
25+
"create-dev-docs": "@php .scripts/create-actions-filters-docs.php",
26+
"phpcs": "vendor/bin/phpcs ./ -s -v",
27+
"phpcs-tests": "vendor/bin/phpcs ./tests --standard=phpcs.tests.xml -s -v",
28+
"phpstan": "vendor/bin/phpstan analyse --memory-limit=1250M",
29+
"test": [
30+
"vendor/bin/codecept build @no_additional_args",
31+
"vendor/bin/codecept run EndToEnd @additional_args --fail-fast"
32+
],
33+
"test-integration": [
34+
"vendor/bin/codecept build @no_additional_args",
35+
"vendor/bin/codecept run Integration @additional_args --fail-fast"
36+
]
37+
},
1938
"archive": {
2039
"exclude": [
2140
"!vendor/*",

0 commit comments

Comments
 (0)