use of org.sonar.php.ini.tree.PhpIniFile in project sonar-php by SonarSource.
the class PhpIniCheckTestUtils method check.
public static void check(PhpIniCheck check, File file) {
PhpFile inputFile = TestUtils.getFile(file);
PhpIniFile phpIniFile = new PhpIniParser().parse(inputFile);
List<PhpIniIssue> actualIssues = check.analyze(phpIniFile);
List<PhpIniIssue> expectedIssues = expectedIssues(file);
compare(actualIssues, expectedIssues);
}
use of org.sonar.php.ini.tree.PhpIniFile in project sonar-php by SonarSource.
the class PhpIniParserTest method directive_by_name.
@Test
public void directive_by_name() {
PhpIniFile phpIniFile = parse("\n name1=value1 \n name2=value2 \n name1=value3");
assertThat(phpIniFile.directivesForName("name1")).extracting(Directive::value).extracting(SyntaxToken::text).containsOnly("value1", "value3");
assertThat(phpIniFile.directivesForName("x")).isEmpty();
}
use of org.sonar.php.ini.tree.PhpIniFile in project sonar-php by SonarSource.
the class PhpIniParserTest method parse_file.
@Test
public void parse_file() throws Exception {
PhpFile file = FileTestUtils.getFile(new File("src/test/resources/phpini/php.ini"));
PhpIniFile phpIni = new PhpIniParser().parse(file);
assertThat(phpIni.directives()).hasSize(1);
assertThat(phpIni.directives().get(0).name().text()).isEqualTo("max_execution_time");
}
use of org.sonar.php.ini.tree.PhpIniFile in project sonar-php by SonarSource.
the class PhpIniCheckTestUtils method check.
public static void check(PhpIniCheck check, File file, List<PhpIniIssue> expectedIssues) {
PhpFile inputFile = TestUtils.getFile(file);
PhpIniFile phpIniFile = new PhpIniParser().parse(inputFile);
List<PhpIniIssue> actualIssues = check.analyze(phpIniFile);
compare(actualIssues, expectedIssues);
}
use of org.sonar.php.ini.tree.PhpIniFile in project sonar-php by SonarSource.
the class PhpIniParserTest method checkSingleDirective.
private static void checkSingleDirective(String toParse, String expectedName, String expectedValue) {
PhpIniFile file = parse(toParse);
assertThat(file.directives()).hasSize(1);
Directive directive = file.directives().get(0);
checkDirective(directive, expectedName, expectedValue);
}
Aggregations