-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ruleset::populateTokenListeners(): add tests
- Loading branch information
Showing
9 changed files
with
655 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/InvalidSniffs/RegisterNoArraySniff.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* Test fixture. | ||
* | ||
* @see \PHP_CodeSniffer\Tests\Core\Ruleset\PopulateTokenListenersTest | ||
*/ | ||
|
||
namespace Fixtures\TestStandard\Sniffs\InvalidSniffs; | ||
|
||
use PHP_CodeSniffer\Files\File; | ||
use PHP_CodeSniffer\Sniffs\Sniff; | ||
|
||
class RegisterNoArraySniff implements Sniff | ||
{ | ||
|
||
public function register() | ||
{ | ||
return false; | ||
} | ||
|
||
public function process(File $phpcsFile, $stackPtr) | ||
{ | ||
// Do something. | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/ValidSniffs/RegisterEmptyArraySniff.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* Test fixture. | ||
* | ||
* @see \PHP_CodeSniffer\Tests\Core\Ruleset\PopulateTokenListenersTest | ||
*/ | ||
|
||
namespace Fixtures\TestStandard\Sniffs\ValidSniffs; | ||
|
||
use PHP_CodeSniffer\Files\File; | ||
use PHP_CodeSniffer\Sniffs\Sniff; | ||
|
||
class RegisterEmptyArraySniff implements Sniff | ||
{ | ||
|
||
public function register() | ||
{ | ||
return []; | ||
} | ||
|
||
public function process(File $phpcsFile, $stackPtr) | ||
{ | ||
// Do something. | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/Core/Ruleset/PopulateTokenListenersRegisterNoArrayTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PopulateTokenListenersTest" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd"> | ||
|
||
<config name="installed_paths" value="./tests/Core/Ruleset/Fixtures/TestStandard/"/> | ||
|
||
<rule ref="TestStandard.InvalidSniffs.RegisterNoArray"/> | ||
|
||
</ruleset> |
Oops, something went wrong.