You are here

class Drupal_GoodUnitTest in Coder 7.2

Unit test class for all good files that must not throw errors/warnings.

Hierarchy

Expanded class hierarchy of Drupal_GoodUnitTest

File

coder_sniffer/Test/good/GoodUnitTest.php, line 9

View source
class Drupal_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) {
    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) {
    return array();
  }

  //end getWarningList()

  /**
   * Returns a list of test files that should be checked.
   *
   * @return array The list of test files.
   */
  protected function getTestFiles() {
    $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 getSniffCodes() {

    // We want to test all sniffs defined in the standard.
    return array();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CoderSniffUnitTest::$phpcs protected static property The PHP_CodeSniffer object used for testing.
CoderSniffUnitTest::generateFailureMessages public function Generate a list of test failures for a given sniffed file.
CoderSniffUnitTest::setUp protected function Sets up this unit test.
CoderSniffUnitTest::shouldSkipTest protected function Should this test be skipped for some reason.
CoderSniffUnitTest::testSniff final public function Tests the extending classes Sniff class.
Drupal_GoodUnitTest::getErrorList public function Returns the lines where errors should occur. Overrides CoderSniffUnitTest::getErrorList
Drupal_GoodUnitTest::getSniffCodes protected function Returns a list of sniff codes that should be checked in this test. Overrides CoderSniffUnitTest::getSniffCodes
Drupal_GoodUnitTest::getTestFiles protected function Returns a list of test files that should be checked. Overrides CoderSniffUnitTest::getTestFiles
Drupal_GoodUnitTest::getWarningList public function Returns the lines where warnings should occur. Overrides CoderSniffUnitTest::getWarningList