class VariableAnalysisUnitTest in Coder 8.3.x
Same name and namespace in other branches
- 8.3 tests/DrupalPractice/CodeAnalysis/VariableAnalysisUnitTest.php \DrupalPractice\Test\CodeAnalysis\VariableAnalysisUnitTest
Unit test class for the VariableAnalysis sniff.
A sniff unit test checks a .inc file for expected violations of a single coding standard. Expected errors and warnings are stored in this class.
Hierarchy
- class \Drupal\Test\CoderSniffUnitTest extends \Drupal\Test\PhpunitCompatibilityTestCase
- class \DrupalPractice\Test\CodeAnalysis\VariableAnalysisUnitTest
Expanded class hierarchy of VariableAnalysisUnitTest
File
- tests/
DrupalPractice/ CodeAnalysis/ VariableAnalysisUnitTest.php, line 13
Namespace
DrupalPractice\Test\CodeAnalysisView source
class VariableAnalysisUnitTest 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.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
protected function getErrorList(string $testFile) : array {
return [];
}
//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.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
protected function getWarningList(string $testFile) : array {
return [
4 => 1,
8 => 1,
17 => 1,
61 => 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:: |
protected | function | Sets up this unit test. | |
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 | Should this test be skipped for some reason. | |
CoderSniffUnitTest:: |
final public | function | Tests the extending classes Sniff class. | |
VariableAnalysisUnitTest:: |
protected | function |
Returns the lines where errors should occur. Overrides CoderSniffUnitTest:: |
|
VariableAnalysisUnitTest:: |
protected | function |
Returns the lines where warnings should occur. Overrides CoderSniffUnitTest:: |