Skip to content

Commit 3918ecd

Browse files
committed
Updated testing docs to include using PHP CodeSniffer on code
1 parent bc4dfaf commit 3918ecd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

TESTING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ If a test fails, you can inspect the output.
3636

3737
Any errors should be corrected by making applicable code or test changes.
3838

39+
## Run PHP CodeSniffer
40+
41+
[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) checks that all code meets the [PSR-12 Coding Standards](https://www.php-fig.org/psr/psr-12/).
42+
43+
To run CodeSniffer on tests, enter the following command:
44+
45+
```bash
46+
vendor/bin/phpcs
47+
```
48+
49+
Any errors should be corrected by either:
50+
- making applicable code changes
51+
- (Experimental) running `vendor/bin/phpcbf` to automatically fix coding standards
52+
53+
Need to change the coding standard rules applied? Either:
54+
- ignore a rule in the affected code, by adding `phpcs:ignore {rule}`, where {rule} is the given rule that failed in the above output.
55+
- edit the [phpcs.tests.xml](phpcs.xml) file.
56+
57+
**Rules can be ignored with caution**, but it's essential that rules relating to coding style and inline code commenting / docblocks remain.
58+
3959
## Run PHP CodeSniffer for Tests
4060

4161
[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) checks that all test code meets the [PSR-12 Coding Standards](https://www.php-fig.org/psr/psr-12/).

0 commit comments

Comments
 (0)