ErrorSuppressionTest
extends TestCase
in package
Tests for PHP_CodeSniffer error suppression tags.
Tags
Table of Contents
Methods
- dataCommenting() : array<string, array<string, string|int>>
- Data provider.
- dataDisableSelected() : array<string, array<string, string|int>>
- Data provider.
- dataEnableSelected() : array<string, array<string, string|int>>
- Data provider.
- dataIgnoreSelected() : array<string, array<string, string|int>>
- Data provider.
- dataNestedSuppressLine() : array<string, array<string, string>>
- Data provider.
- dataSuppressError() : array<string, array<string, string|int>>
- Data provider.
- dataSuppressFile() : array<string, array<string, string|int>>
- Data provider.
- dataSuppressLine() : array<string, array<string, string|int>>
- Data provider.
- dataSuppressScope() : array<string, array<string, string|int>>
- Data provider.
- dataSuppressSomeErrors() : array<string, array<string, string|int>>
- Data provider.
- dataSuppressWarning() : array<string, array<string, string|int>>
- Data provider.
- testCommenting() : void
- Test ignoring specific sniffs.
- testDisableSelected() : void
- Test disabling specific sniffs.
- testEnableSelected() : void
- Test re-enabling specific sniffs that have been disabled.
- testIgnoreSelected() : void
- Test ignoring specific sniffs.
- testNestedSuppressLine() : void
- Test that using a single line ignore does not interfere with other suppressions.
- testSuppressError() : void
- Test suppressing a single error.
- testSuppressFile() : void
- Test suppressing a whole file.
- testSuppressLine() : void
- Test suppressing a single error using a single line ignore.
- testSuppressLineMidLine() : void
- Test suppressing a single error using a single line ignore in the middle of a line.
- testSuppressLineWithinDocblock() : void
- Test suppressing a single error using a single line ignore within a docblock.
- testSuppressScope() : void
- Test suppressing a scope opener.
- testSuppressSomeErrors() : void
- Test suppressing 1 out of 2 errors.
- testSuppressWarning() : void
- Test suppressing a single warning.
Methods
dataCommenting()
Data provider.
public
static dataCommenting() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>dataDisableSelected()
Data provider.
public
static dataDisableSelected() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>dataEnableSelected()
Data provider.
public
static dataEnableSelected() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>dataIgnoreSelected()
Data provider.
public
static dataIgnoreSelected() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>dataNestedSuppressLine()
Data provider.
public
static dataNestedSuppressLine() : array<string, array<string, string>>
Tags
Return values
array<string, array<string, string>>dataSuppressError()
Data provider.
public
static dataSuppressError() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>dataSuppressFile()
Data provider.
public
static dataSuppressFile() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>dataSuppressLine()
Data provider.
public
static dataSuppressLine() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>dataSuppressScope()
Data provider.
public
static dataSuppressScope() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>dataSuppressSomeErrors()
Data provider.
public
static dataSuppressSomeErrors() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>dataSuppressWarning()
Data provider.
public
static dataSuppressWarning() : array<string, array<string, string|int>>
Tags
Return values
array<string, array<string, string|int>>testCommenting()
Test ignoring specific sniffs.
public
testCommenting(string $code, int $expectedErrors, int $expectedWarnings) : void
Parameters
- $code : string
-
Code pattern to check.
- $expectedErrors : int
-
Number of errors expected.
- $expectedWarnings : int
-
Number of warnings expected.
Tags
testDisableSelected()
Test disabling specific sniffs.
public
testDisableSelected(string $before[, int $expectedErrors = 0 ][, int $expectedWarnings = 0 ]) : void
Parameters
- $before : string
-
Annotation to place before the code.
- $expectedErrors : int = 0
-
Optional. Number of errors expected. Defaults to 0.
- $expectedWarnings : int = 0
-
Optional. Number of warnings expected. Defaults to 0.
Tags
testEnableSelected()
Test re-enabling specific sniffs that have been disabled.
public
testEnableSelected(string $code, int $expectedErrors, int $expectedWarnings) : void
Parameters
- $code : string
-
Code pattern to check.
- $expectedErrors : int
-
Number of errors expected.
- $expectedWarnings : int
-
Number of warnings expected.
Tags
testIgnoreSelected()
Test ignoring specific sniffs.
public
testIgnoreSelected(string $before, int $expectedErrors, int $expectedWarnings) : void
Parameters
- $before : string
-
Annotation to place before the code.
- $expectedErrors : int
-
Number of errors expected.
- $expectedWarnings : int
-
Number of warnings expected.
Tags
testNestedSuppressLine()
Test that using a single line ignore does not interfere with other suppressions.
public
testNestedSuppressLine(string $before, string $after) : void
Parameters
- $before : string
-
Annotation to place before the code.
- $after : string
-
Annotation to place after the code.
Tags
testSuppressError()
Test suppressing a single error.
public
testSuppressError(string $before, string $after[, int $expectedErrors = 0 ]) : void
Parameters
- $before : string
-
Annotation to place before the code.
- $after : string
-
Annotation to place after the code.
- $expectedErrors : int = 0
-
Optional. Number of errors expected. Defaults to 0.
Tags
testSuppressFile()
Test suppressing a whole file.
public
testSuppressFile(string $before[, string $after = '' ][, int $expectedWarnings = 0 ]) : void
Parameters
- $before : string
-
Annotation to place before the code.
- $after : string = ''
-
Optional. Annotation to place after the code. Defaults to an empty string.
- $expectedWarnings : int = 0
-
Optional. Number of warnings expected. Defaults to 0.
Tags
testSuppressLine()
Test suppressing a single error using a single line ignore.
public
testSuppressLine(string $before[, string $after = '' ][, int $expectedErrors = 1 ]) : void
Parameters
- $before : string
-
Annotation to place before the code.
- $after : string = ''
-
Optional. Annotation to place after the code. Defaults to an empty string.
- $expectedErrors : int = 1
-
Optional. Number of errors expected. Defaults to 1.
Tags
testSuppressLineMidLine()
Test suppressing a single error using a single line ignore in the middle of a line.
public
testSuppressLineMidLine() : void
testSuppressLineWithinDocblock()
Test suppressing a single error using a single line ignore within a docblock.
public
testSuppressLineWithinDocblock() : void
testSuppressScope()
Test suppressing a scope opener.
public
testSuppressScope(string $before, string $after[, int $expectedErrors = 0 ]) : void
Parameters
- $before : string
-
Annotation to place before the scope opener.
- $after : string
-
Annotation to place after the scope opener.
- $expectedErrors : int = 0
-
Optional. Number of errors expected. Defaults to 0.
Tags
testSuppressSomeErrors()
Test suppressing 1 out of 2 errors.
public
testSuppressSomeErrors(string $before, string $between[, int $expectedErrors = 1 ]) : void
Parameters
- $before : string
-
Annotation to place before the code.
- $between : string
-
Annotation to place between the code.
- $expectedErrors : int = 1
-
Optional. Number of errors expected. Defaults to 1.
Tags
testSuppressWarning()
Test suppressing a single warning.
public
testSuppressWarning(string $before, string $after[, int $expectedWarnings = 0 ]) : void
Parameters
- $before : string
-
Annotation to place before the code.
- $after : string
-
Annotation to place after the code.
- $expectedWarnings : int = 0
-
Optional. Number of warnings expected. Defaults to 0.