Class PHPCheckTest

java.lang.Object
org.sonar.plugins.php.api.tests.PHPCheckTest

public class PHPCheckTest extends Object
Helper class for checks unit test. Code sample file: code_sample.php When an issue is expected on a line, it should contains a comment as the following
  <?php

  $a = 1;  // NOK {{expected issue message}}
  $a = 2;  // NOK
 
  • Method Details

    • check

      public static void check(PHPCheck check, PhpFile file)
      Verifies that the given check raises issue as expected.
      Parameters:
      check - the tested check
      file - File containing the php code sample annotated with comment for expected issues.
    • check

      public static void check(PHPCheck check, PhpFile file, List<PhpIssue> expectedIssues)
      Verifies that the given check raises issue as expected.
      Parameters:
      check - the tested check
      file - File containing the php code sample
      expectedIssues - expected issues that should be raise. Overrides the comments in the code sample.