class DeprecatedUnitTest in Coder 8.3
Same name and namespace in other branches
- 8.3.x tests/Drupal/Commenting/DeprecatedUnitTest.php \Drupal\Test\Commenting\DeprecatedUnitTest
Hierarchy
- class \Drupal\Test\CoderSniffUnitTest extends \PHPUnit\Framework\TestCase
- class \Drupal\Test\Commenting\DeprecatedUnitTest
Expanded class hierarchy of DeprecatedUnitTest
File
- tests/
Drupal/ Commenting/ DeprecatedUnitTest.php, line 7
Namespace
Drupal\Test\CommentingView source
class DeprecatedUnitTest extends CoderSniffUnitTest {
/**
* Returns the lines where errors should occur.
*
* The key of the array should represent the line number and the value
* should represent the number of errors that should occur on that line.
*
* There are three deprecated sniffs which produce an error:
* 'IncorrectTextLayout - for the basic deprecation text, sometimes fixable.
* 'MissingExtraInfo' - when there is no extra info after the main text.
* 'DeprecatedMissingSeeTag' - when there is no @see tag.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
protected function getErrorList(string $testFile) : array {
return [
// Basic layout is wrong. Missing see url.
24 => 2,
// No details given, check that the test gives two errors.
75 => 2,
// Layout OK but missing the extra info.
81 => 1,
// Text layout is wrong but fixable.
89 => 1,
// Text layout is wrong but fixable.
98 => 1,
// See Url has trailing punctuation which is fixable.
101 => 1,
];
}
//end getErrorList()
/**
* Returns the lines where warnings should occur.
*
* The key of the array should represent the line number and the value
* should represent the number of warnings that should occur on that line.
*
* There are two deprecated sniffs which produce a warning:
* 'DeprecatedVersionFormat' - where the version is written incorrectly.
* 'DeprecatedWrongSeeUrlFormat' - the url is not to the standard format.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
protected function getWarningList(string $testFile) : array {
return [
// Both core versions incorrectly formatted.
37 => 2,
// The see url is wrong.
39 => 1,
// Both contrib versions incorrectly formatted.
47 => 2,
// The see url is wrong.
49 => 1,
// Core version incorrectly formatted.
81 => 1,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CoderSniffUnitTest:: |
protected | property | Enable or disable the backup and restoration of the $GLOBALS array. Overwrite this attribute in a child class of TestCase. Setting this attribute in setUp() has no effect! | |
CoderSniffUnitTest:: |
private | property | The path to the root folder of Coder. | |
CoderSniffUnitTest:: |
public | property | The path to the standard's main directory. | |
CoderSniffUnitTest:: |
public | property | The path to the standard's test directory. | |
CoderSniffUnitTest:: |
protected | function | False if just the current sniff should be checked, true if all sniffs should be checked. | 3 |
CoderSniffUnitTest:: |
public | function | Generate a list of test failures for a given sniffed file. | |
CoderSniffUnitTest:: |
protected | function | Get a list of all test files to check. | 20 |
CoderSniffUnitTest:: |
public | function | Set a list of CLI values before the file is tested. | |
CoderSniffUnitTest:: |
protected | function | Sets up this unit test. | |
CoderSniffUnitTest:: |
protected | function | Should this test be skipped for some reason. | |
CoderSniffUnitTest:: |
final public | function | Tests the extending classes Sniff class. | |
DeprecatedUnitTest:: |
protected | function |
Returns the lines where errors should occur. Overrides CoderSniffUnitTest:: |
|
DeprecatedUnitTest:: |
protected | function |
Returns the lines where warnings should occur. Overrides CoderSniffUnitTest:: |