class GoodUnitTest in Coder 8.2
Same name in this branch
- 8.2 coder_sniffer/DrupalPractice/Test/good/GoodUnitTest.php \DrupalPractice\good\GoodUnitTest
- 8.2 coder_sniffer/Drupal/Test/good/GoodUnitTest.php \Drupal\good\GoodUnitTest
Unit test class for all good files that must not throw errors/warnings.
Hierarchy
- class \Drupal\Test\CoderSniffUnitTest extends \Drupal\Test\PHPUnit_Framework_TestCase
- class \Drupal\good\GoodUnitTest
Expanded class hierarchy of GoodUnitTest
File
- coder_sniffer/
Drupal/ Test/ good/ GoodUnitTest.php, line 13
Namespace
Drupal\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.
*
* @return array(int => int)
*/
public function getErrorList($testFile = NULL) {
return array();
}
//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.
*
* @return array(int => int)
*/
public function getWarningList($testFile = NULL) {
return array();
}
//end getWarningList()
/**
* Returns a list of test files that should be checked.
*
* @return array The list of test files.
*/
protected function getTestFiles($testFileBase) {
$dir = dirname(__FILE__);
$di = new \DirectoryIterator($dir);
foreach ($di as $file) {
$path = $file
->getPathname();
if ($path !== __FILE__ && $file
->isFile()) {
$testFiles[] = $path;
}
}
// Get them in order.
sort($testFiles);
return $testFiles;
}
/**
* Returns a list of sniff codes that should be checked in this test.
*
* @return array The list of sniff codes.
*/
protected function allSniffCodes() {
// 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:: |
public | property | The path to the standard's main directory. | |
CoderSniffUnitTest:: |
public | property | The path to the standard's test directory. | |
CoderSniffUnitTest:: |
public | function | Generate a list of test failures for a given sniffed file. | |
CoderSniffUnitTest:: |
public | function | Get a list of CLI values to set 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. | |
GoodUnitTest:: |
protected | function |
Returns a list of sniff codes that should be checked in this test. Overrides CoderSniffUnitTest:: |
|
GoodUnitTest:: |
public | 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:: |
public | function |
Returns the lines where warnings should occur. Overrides CoderSniffUnitTest:: |