Commit 8581c40
committed
Security/PHPFilterFunctions: improve the tests
* Test against false positives for calls to methods or namespaced function calls.
* Test against false positives for attribute class using the same name as the function.
* Ensure function import `use` statements are not flagged. We're not interested in those.
* Document that if the filter is passed in dynamically (via a variable or function call), the sniff will stay silent.
* Add some more variations to the pre-existing tests:
- Non-lowercase function call(s).
- Fully qualified function calls.
- Use PHP 7.3+ trailing comma's in a few function calls.1 parent 052706b commit 8581c40
File tree
2 files changed
+57
-28
lines changed- WordPressVIPMinimum/Tests/Security
2 files changed
+57
-28
lines changedLines changed: 45 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
8 | 27 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 28 | + | |
| 29 | + | |
12 | 30 | | |
13 | | - | |
14 | 31 | | |
15 | | - | |
16 | 32 | | |
17 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
18 | 44 | | |
19 | | - | |
20 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
21 | 48 | | |
22 | | - | |
| 49 | + | |
23 | 50 | | |
24 | | - | |
| 51 | + | |
| 52 | + | |
25 | 53 | | |
26 | 54 | | |
| 55 | + | |
27 | 56 | | |
28 | | - | |
29 | | - | |
| 57 | + | |
| 58 | + | |
Lines changed: 12 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
0 commit comments