class GoodUnitTest in Coder 8.3.x
Same name in this branch
- 8.3.x tests/DrupalPractice/good/GoodUnitTest.php \DrupalPractice\Test\good\GoodUnitTest
- 8.3.x tests/Drupal/good/GoodUnitTest.php \Drupal\Test\good\GoodUnitTest
Same name and namespace in other branches
- 8.3 tests/DrupalPractice/good/GoodUnitTest.php \DrupalPractice\Test\good\GoodUnitTest
Unit test class for all good files that must not throw errors/warnings.
Hierarchy
- class \Drupal\Test\CoderSniffUnitTest extends \Drupal\Test\PhpunitCompatibilityTestCase
- class \DrupalPractice\Test\good\GoodUnitTest
Expanded class hierarchy of GoodUnitTest
File
- tests/
DrupalPractice/ good/ GoodUnitTest.php, line 13
Namespace
DrupalPractice\Test\goodView source
class GoodUnitTest 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 [];
}
//end getWarningList()
/**
* Returns a list of test files that should be checked.
*
* @param string $testFileBase The base path that the unit tests files will have.
*
* @return array<string>
*/
protected function getTestFiles($testFileBase) : array {
return [
__DIR__ . '/good.php',
];
}
//end getTestFiles()
/**
* False if just the current sniff should be checked, true if all sniffs should be checked.
*
* @return bool
*/
protected function checkAllSniffCodes() {
// We want to test all sniffs defined in the standard.
return true;
}
}
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 | Sets up this unit test. | |
CoderSniffUnitTest:: |
public | function | Generate a list of test failures for a given sniffed file. | |
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. | |
GoodUnitTest:: |
protected | function |
False if just the current sniff should be checked, true if all sniffs should be checked. Overrides CoderSniffUnitTest:: |
|
GoodUnitTest:: |
protected | function |
Returns the lines where errors should occur. Overrides CoderSniffUnitTest:: |
|
GoodUnitTest:: |
protected | function |
Returns a list of test files that should be checked. Overrides CoderSniffUnitTest:: |
|
GoodUnitTest:: |
protected | function |
Returns the lines where warnings should occur. Overrides CoderSniffUnitTest:: |