You are here

coder_review_sniffer.test in Coder 7.2

File

coder_review/tests/coder_review_sniffer.test
View source
<?php

/**
 * @file
 * Set of simpletests of Coder Sniffer review.
 */
require_once dirname(__FILE__) . '/coder_review_test_case.tinc';

/**
 * Class to test for the coder sniffer rules.
 */
class CoderReviewSnifferTest extends CoderReviewTestCase {

  /**
   * Constructor that creates a CoderReviewSnifferTest instance.
   *
   * @param string|null $id
   *   (optional) The test identifier. Defaults to NULL.
   */
  function __construct($id = NULL) {

    // Remove the Drupal autoloading classes so that CodeSniffer can load it's
    // own classes. Without this, these tests would need to run with
    // DrupalWebTestCase instead of DrupalUnitTestCase.
    spl_autoload_unregister('drupal_autoload_class');
    spl_autoload_unregister('drupal_autoload_interface');
    parent::__construct('sniffer', $id);
  }
  public static function getInfo() {
    return array(
      'name' => 'Coder Review Sniffer Tests',
      'description' => 'Tests for the coder sniffer review.',
      'group' => 'CoderReview',
    );
  }

  /**
   * Tests sample case.
   */
  function testDocblockLineTooLong() {
    $this
      ->assertCoderReviewFail("/**\n * 456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n **/");
  }

}

Classes

Namesort descending Description
CoderReviewSnifferTest Class to test for the coder sniffer rules.