Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ When you introduce new `public` sniff properties, or your sniff extends a class
### Pre-requisites
* VIP Coding Standards
* WordPress-Coding-Standards
* VariableAnalysis
* PHPCSUtils 1.x
* PHP_CodeSniffer 3.x
* PHPUnit 4.x - 9.x
Expand Down Expand Up @@ -144,15 +145,18 @@ The easiest way to do this is to add a `phpunit.xml` file to the root of your VI

Expected output:
```
PHPUnit 9.6.15 by Sebastian Bergmann and contributors.
Note: Tests are running in "CS" mode

........................................ 40 / 40 (100%)
PHPUnit 9.6.23 by Sebastian Bergmann and contributors.

45 sniff test files generated 175 unique error codes; 0 were fixable (0%)
Runtime: PHP 8.4.10
Configuration: phpunit.xml.dist

Time: 150 ms, Memory: 20.00 MB
....................................... 39 / 39 (100%)

OK (40 tests, 0 assertions)
52 sniff test files generated 172 unique error codes; 0 were fixable (0%)

Time: 00:00.862, Memory: 58.00 MB
```

### Unit Testing conventions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ protected function setup_groups() {
* @param int $stackPtr The position of the current token in the stack.
* @return int|void Integer stack pointer to skip forward or void to continue
* normal file processing.
*
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException Exception.
*/
public function process_token( $stackPtr ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function process_token( $stackPtr ) {

$html = $this->phpcsFile->findPrevious( $ignore, $stackPtr - 1, null, true );

// Use $textStringTokens b/c heredoc and nowdoc tokens will never be encountered in this context anyways..
// Use $textStringTokens b/c heredoc and nowdoc tokens will never be encountered in this context anyways.
if ( $html === false || isset( Tokens::$textStringTokens[ $this->tokens[ $html ]['code'] ] ) === false ) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class AdminBarRemovalSniff extends AbstractFunctionParameterSniff {
];

/**
* String tokens within PHP files we want to deal with.
* Text string tokens within PHP files we want to deal with.
*
* Set from the register() method.
*
Expand Down Expand Up @@ -120,7 +120,7 @@ class AdminBarRemovalSniff extends AbstractFunctionParameterSniff {
* @return array<int|string>
*/
public function register() {
// Set up all string targets.
// Set up all text string targets.
$this->string_tokens = Tokens::$textStringTokens;

$targets = $this->string_tokens;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the ConstantRestrictions sniff.
* Unit test class for the RestrictedConstants sniff.
*
* @covers \WordPressVIPMinimum\Sniffs\Constants\RestrictedConstantsSniff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the Hooks/AlwaysReturn sniff.
* Unit test class for the AlwaysReturnInFilter sniff.
*
* @covers \WordPressVIPMinimum\Sniffs\Hooks\AlwaysReturnInFilterSniff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
/**
* Unit test class for the Filters/RestrictedHooks sniff.
* Unit test class for the RestrictedHooks sniff.
*
* @since 0.4.0
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the HTML String concatenation in JS sniff.
* Unit test class for the DangerouslySetInnerHTML sniff.
*
* @covers \WordPressVIPMinimum\Sniffs\JS\DangerouslySetInnerHTMLSniff
*/
Expand Down
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/Tests/JS/InnerHTMLUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the HTML String concatenation in JS sniff.
* Unit test class for the InnerHTML sniff.
*
* @covers \WordPressVIPMinimum\Sniffs\JS\InnerHTMLSniff
*/
Expand Down
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/Tests/JS/WindowUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the HTML String concatenation in JS sniff.
* Unit test class for the JS/Window sniff.
*
* @covers \WordPressVIPMinimum\Sniffs\JS\WindowSniff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the ExitAfterRedirect sniff.
* Unit test class for the FetchingRemoteData sniff.
*
* @covers \WordPressVIPMinimum\Sniffs\Performance\FetchingRemoteDataSniff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the WP_Query params sniff.
* Unit test class for the PHPFilterFunctions sniff.
*
* @covers \WordPressVIPMinimum\Sniffs\Security\PHPFilterFunctionsSniff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the VIP_RestrictedVariables sniff.
* Unit test class for the RestrictedVariables sniff.
*
* @covers \WordPressVIPMinimum\Sniffs\Variables\RestrictedVariablesSniff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the Variable Analysis sniff.
* Unit test class for the ServerVariables sniff.
*
* @covers \WordPressVIPMinimum\Sniffs\Variables\ServerVariablesSniff
*/
Expand Down