You are here

class FileCommentUnitTest in Coder 8.3

Same name and namespace in other branches
  1. 8.3.x tests/Drupal/Commenting/FileCommentUnitTest.php \Drupal\Test\Commenting\FileCommentUnitTest

Hierarchy

Expanded class hierarchy of FileCommentUnitTest

File

tests/Drupal/Commenting/FileCommentUnitTest.php, line 7

Namespace

Drupal\Test\Commenting
View source
class FileCommentUnitTest 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 {
    switch ($testFile) {
      case 'FileCommentUnitTest.inc':
        return [
          1 => 1,
        ];
      case 'FileCommentUnitTest.1.inc':
        return [
          3 => 1,
        ];
      case 'FileCommentUnitTest.2.inc':
        return [
          4 => 1,
        ];
      case 'FileCommentUnitTest.3.inc':
        return [
          4 => 1,
        ];
      case 'FileCommentUnitTest.4.inc':
        return [
          3 => 1,
        ];
      case 'FileCommentUnitTest.5.inc':
        return [
          1 => 1,
        ];
      case 'FileCommentUnitTest.6.inc':
        return [
          3 => 1,
        ];
      case 'FileCommentUnitTest.7.inc':
        return [];
      case 'FileCommentUnitTest.8.inc':
        return [
          3 => 1,
        ];
      case 'FileCommentUnitTest.9.inc':
        return [
          3 => 1,
        ];
      case 'FileCommentUnitTest.10.inc':
        return [
          4 => 1,
        ];
      case 'FileCommentUnitTest.11.inc':
        return [
          4 => 1,
        ];
      case 'FileCommentUnitTest.12.inc':
        return [
          2 => 1,
        ];
    }

    //end switch
    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 [];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CoderSniffUnitTest::$backupGlobals 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::$rootDir private property The path to the root folder of Coder.
CoderSniffUnitTest::$standardsDir public property The path to the standard's main directory.
CoderSniffUnitTest::$testsDir public property The path to the standard's test directory.
CoderSniffUnitTest::checkAllSniffCodes protected function False if just the current sniff should be checked, true if all sniffs should be checked. 3
CoderSniffUnitTest::generateFailureMessages public function Generate a list of test failures for a given sniffed file.
CoderSniffUnitTest::getTestFiles protected function Get a list of all test files to check. 20
CoderSniffUnitTest::setCliValues public function Set a list of CLI values before the file is tested.
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.
FileCommentUnitTest::getErrorList protected function Returns the lines where errors should occur. Overrides CoderSniffUnitTest::getErrorList
FileCommentUnitTest::getWarningList protected function Returns the lines where warnings should occur. Overrides CoderSniffUnitTest::getWarningList