ShowSniffDeprecationsTest
extends TestCase
in package
Tests PHPCS native handling of sniff deprecations.
Tags
Table of Contents
Methods
- dataDeprecatedSniffsListDoesNotShow() : array<string, array<string, string|array<string|int, string>>>
- Data provider.
- dataExceptionIsThrownOnIncorrectlyImplementedInterface() : array<string, array<string, string>>
- Data provider.
- dataHasSniffDeprecations() : array<string, array<string, string|bool>>
- Data provider.
- dataReportWidthIsRespected() : array<string, array<string, int|string>>
- Data provider.
- testDeprecatedSniffsAreListedAlphabetically() : void
- Test deprecated sniffs are listed alphabetically in the deprecated sniffs warning.
- testDeprecatedSniffsListDoesNotShow() : void
- Test that the listing with deprecated sniffs will not show when specific command-line options are being used.
- testDeprecatedSniffsListDoesNotShowWhenAllDeprecatedSniffsAreExcluded() : void
- Test that the listing with deprecated sniffs will not show when using a standard containing deprecated sniffs, but all deprecated sniffs have been excluded from the run (using `--exclude=...`).
- testDeprecatedSniffsListDoesNotShowWhenSelectedSniffsAreNotDeprecated() : void
- Test that the listing with deprecated sniffs will not show when using a standard containing deprecated sniffs, but only running select non-deprecated sniffs (using `--sniffs=...`).
- testDeprecatedSniffsWarning() : void
- Test deprecated sniffs are listed alphabetically in the deprecated sniffs warning.
- testExceptionIsThrownOnIncorrectlyImplementedInterface() : void
- Test that an exception is thrown when any of the interface required methods does not comply with the return type/value requirements.
- testHasSniffDeprecations() : void
- Test the return value of the hasSniffDeprecations() method.
- testReportWidthIsRespected() : void
- Test deprecated sniffs are listed alphabetically in the deprecated sniffs warning.
Methods
dataDeprecatedSniffsListDoesNotShow()
Data provider.
public
static dataDeprecatedSniffsListDoesNotShow() : array<string, array<string, string|array<string|int, string>>>
Tags
Return values
array<string, array<string, string|array<string|int, string>>>dataExceptionIsThrownOnIncorrectlyImplementedInterface()
Data provider.
public
static dataExceptionIsThrownOnIncorrectlyImplementedInterface() : array<string, array<string, string>>
Tags
Return values
array<string, array<string, string>>dataHasSniffDeprecations()
Data provider.
public
static dataHasSniffDeprecations() : array<string, array<string, string|bool>>
Tags
Return values
array<string, array<string, string|bool>>dataReportWidthIsRespected()
Data provider.
public
static dataReportWidthIsRespected() : array<string, array<string, int|string>>
Tags
Return values
array<string, array<string, int|string>>testDeprecatedSniffsAreListedAlphabetically()
Test deprecated sniffs are listed alphabetically in the deprecated sniffs warning.
public
testDeprecatedSniffsAreListedAlphabetically() : void
Additionally, this test verifies that deprecated sniffs are still registered to run.
testDeprecatedSniffsListDoesNotShow()
Test that the listing with deprecated sniffs will not show when specific command-line options are being used.
public
testDeprecatedSniffsListDoesNotShow(string $standard[, array<string|int, string> $additionalArgs = [] ]) : void
Parameters
- $standard : string
-
The standard to use for the test.
- $additionalArgs : array<string|int, string> = []
-
Optional. Additional arguments to pass.
Tags
testDeprecatedSniffsListDoesNotShowWhenAllDeprecatedSniffsAreExcluded()
Test that the listing with deprecated sniffs will not show when using a standard containing deprecated sniffs, but all deprecated sniffs have been excluded from the run (using `--exclude=...`).
public
testDeprecatedSniffsListDoesNotShowWhenAllDeprecatedSniffsAreExcluded() : void
testDeprecatedSniffsListDoesNotShowWhenSelectedSniffsAreNotDeprecated()
Test that the listing with deprecated sniffs will not show when using a standard containing deprecated sniffs, but only running select non-deprecated sniffs (using `--sniffs=...`).
public
testDeprecatedSniffsListDoesNotShowWhenSelectedSniffsAreNotDeprecated() : void
testDeprecatedSniffsWarning()
Test deprecated sniffs are listed alphabetically in the deprecated sniffs warning.
public
testDeprecatedSniffsWarning() : void
This tests a number of different aspects:
- That the summary line uses the correct grammar when there is are multiple deprecated sniffs.
- That there is no trailing whitespace when the sniff does not provide a custom message.
- That custom messages containing new line characters (any type) are handled correctly and that those new line characters are converted to the OS supported new line char.
testExceptionIsThrownOnIncorrectlyImplementedInterface()
Test that an exception is thrown when any of the interface required methods does not comply with the return type/value requirements.
public
testExceptionIsThrownOnIncorrectlyImplementedInterface(string $standard, string $exceptionMessage) : void
Parameters
- $standard : string
-
The standard to use for the test.
- $exceptionMessage : string
-
The contents of the expected exception message.
Tags
testHasSniffDeprecations()
Test the return value of the hasSniffDeprecations() method.
public
testHasSniffDeprecations(string $standard, bool $expected) : void
Parameters
- $standard : string
-
The standard to use for the test.
- $expected : bool
-
The expected function return value.
Tags
testReportWidthIsRespected()
Test deprecated sniffs are listed alphabetically in the deprecated sniffs warning.
public
testReportWidthIsRespected(int $reportWidth, string $expectedOutput) : void
This tests the following aspects:
- That the summary line uses the correct grammar when there is a single deprecated sniff.
- That the separator line below the summary maximizes at the longest line length.
- That the word wrapping respects the maximum report width.
- That the sniff name is truncated if it is longer than the max report width.
Parameters
- $reportWidth : int
-
Report width for the test.
- $expectedOutput : string
-
Expected output.