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: .github/CONTRIBUTING.md
+37-36Lines changed: 37 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,16 +124,16 @@ OK (60 tests, 6 assertions)
124
124
125
125
### Unit Testing conventions
126
126
127
-
If you look inside the `WordPress/Tests` subdirectory, you'll see the structure mimics the `WordPress/Sniffs` subdirectory structure. For example, the `WordPress/Sniffs/PHP/POSIXFunctionsSniff.php` sniff has its unit test class defined in`WordPress/Tests/PHP/POSIXFunctionsUnitTest.php` which checks the `WordPress/Tests/PHP/POSIXFunctionsUnitTest.inc`testcase file. See the file naming convention?
127
+
If you look inside the `WordPress/Tests` subdirectory, you'll see the structure mimics the `WordPress/Sniffs` subdirectory structure. For example, the `WordPress/Sniffs/PHP/TypeCastsSniff.php` sniff has its unit test class defined in`WordPress/Tests/PHP/TypeCastsUnitTest.php` which checks the `WordPress/Tests/PHP/TypeCastsUnitTest.inc`testcase file. See the file naming convention?
128
128
129
-
Lets take a look at what's inside `POSIXFunctionsUnitTest.php`:
129
+
Lets take a look at what's inside `TypeCastsUnitTest.php`:
130
130
131
131
```php
132
132
namespace WordPressCS\WordPress\Tests\PHP;
133
133
134
134
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
135
135
136
-
final class POSIXFunctionsUnitTest extends AbstractSniffUnitTest {
136
+
final class TypeCastsUnitTest extends AbstractSniffUnitTest {
137
137
138
138
/**
139
139
* Returns the lines where errors should occur.
@@ -142,53 +142,54 @@ final class POSIXFunctionsUnitTest extends AbstractSniffUnitTest {
142
142
*/
143
143
public function getErrorList() {
144
144
return array(
145
+
10 => 1,
146
+
11 => 1,
145
147
13 => 1,
146
-
16 => 1,
147
-
18 => 1,
148
-
20 => 1,
149
-
22 => 1,
150
-
24 => 1,
151
148
26 => 1,
149
+
27 => 1,
150
+
28 => 1,
152
151
);
153
152
}
154
153
155
154
...
156
155
}
157
156
```
158
157
159
-
Also note the class name convention. The method `getErrorList()` MUST return an array of line numbers indicating errors (when running `phpcs`) found in `WordPress/Tests/PHP/POSIXFunctionsUnitTest.inc`. Similarly, the `getWarningList()` method must return an array of line numbers with the number of expected warnings.
158
+
Also note the class name convention. The method `getErrorList()` MUST return an array of line numbers indicating errors (when running `phpcs`) found in `WordPress/Tests/PHP/TypeCastsUnitTest.inc`. Similarly, the `getWarningList()` method must return an array of line numbers with the number of expected warnings.
160
159
161
160
If you run the following from the root directory of your WordPressCS clone:
0 commit comments