You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,6 +89,8 @@ To make use of the WP-CLI testing framework, you need to complete the following
89
89
```
90
90
91
91
All other [PHPCS configuration options](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset) are, of course, available.
92
+
The PHP snippets embedded in your feature files are checked along with the rest of the package. See [Checking the code style of the PHP blocks in feature files](#checking-the-code-style-of-the-php-blocks-in-feature-files) below.
93
+
92
94
6. Optionally add a `phpstan-feature-files.neon.dist` file to the package root to also run PHPStan over the PHP snippets embedded in your feature files. See [Analysing the PHP blocks in feature files](#analysing-the-php-blocks-in-feature-files) below.
93
95
94
96
7. Update your composer dependencies and regenerate your autoloader and binary folders:
@@ -176,6 +178,56 @@ Two kinds of blocks are left out of the analysis, and are listed at the end of t
176
178
Blocks that declare the same class or function as another block are analysed separately from each
177
179
other, so that PHPStan does not resolve a name to the wrong block's declaration.
178
180
181
+
### Checking the code style of the PHP blocks in feature files
182
+
183
+
`composer phpcs` also checks the PHP snippets that feature files embed in docstrings, and
184
+
`composer phpcbf` fixes them in place. No configuration is needed, and like the analysis above the
185
+
blocks are padded so that findings are reported against the feature file itself:
The blocks are left alone when a run is narrowed down to a path, as in`composer phpcs -- src/`,
229
+
since such an argument is about the files of the package itself.
230
+
179
231
### Controlling what to test
180
232
181
233
To send one or more arguments to one of the test tools, prepend the argument(s) with a double dash. As an example, here's how to run the functional tests for a specific feature file only:
0 commit comments