11To make use of the WP-CLI testing framework, you need to complete the following steps from within the package you want to add them to:
22
331 . Add the testing framework as a development requirement:
4- ```bash
5- composer require --dev wp-cli/wp-cli-tests
6- ```
4+ ``` bash
5+ composer require --dev wp-cli/wp-cli-tests
6+ ```
77
882. Add the required test scripts to the ` composer.json` file:
9- ```json
10- "scripts": {
9+ ` ` ` json
10+ " scripts" : {
1111 " behat" : " run-behat-tests" ,
1212 " behat-rerun" : " rerun-behat-tests" ,
1313 " lint" : " run-linter-tests" ,
@@ -20,26 +20,26 @@ To make use of the WP-CLI testing framework, you need to complete the following
2020 " @phpunit" ,
2121 " @behat"
2222 ]
23- }
24- ```
25- You can of course remove the ones you don't need.
23+ }
24+ ` ` `
25+ You can of course remove the ones you don' t need.
2626
27273. Optionally add a modified process timeout to the `composer.json` file to make sure scripts can run until their work is completed:
28- ```json
29- "config": {
30- "process-timeout": 1800
31- },
32- ```
33- The timeout is expressed in seconds.
28+ ```json
29+ "config": {
30+ "process-timeout": 1800
31+ },
32+ ```
33+ The timeout is expressed in seconds.
3434
35354. Optionally add a `behat.yml` file to the package root with the following content:
36- ```json
37- default:
38- paths:
39- features: features
36+ ```json
37+ default:
38+ paths:
39+ features: features
4040 bootstrap: vendor/wp-cli/wp-cli-tests/features/bootstrap
41- ```
42- This will make sure that the automated Behat system works across all platforms. This is needed on Windows.
41+ ```
42+ This will make sure that the automated Behat system works across all platforms. This is needed on Windows.
4343
44445. Optionally add a `phpcs.xml.dist` file to the package root to enable code style and best practice checks using PHP_CodeSniffer.
4545
@@ -73,9 +73,9 @@ To make use of the WP-CLI testing framework, you need to complete the following
7373
7474 All other [PHPCS configuration options](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset) are, of course, available.
75756. Update your composer dependencies and regenerate your autoloader and binary folders:
76- ```bash
77- composer update
78- ```
76+ ```bash
77+ composer update
78+ ```
7979
8080You are now ready to use the testing framework from within your package.
8181
0 commit comments