@Test public void should_use_multi_path_coverage() throws Exception { context.setRuntime(SONARQUBE_6_7); context.settings().setProperty(PhpPlugin.PHPUNIT_COVERAGE_REPORT_PATHS_KEY, String.join(",", PhpTestUtils.GENERATED_UT_COVERAGE_REPORT_RELATIVE_PATH, PhpTestUtils.GENERATED_IT_COVERAGE_REPORT_RELATIVE_PATH, " ", PhpTestUtils.GENERATED_OVERALL_COVERAGE_REPORT_RELATIVE_PATH)); DefaultInputFile inputFile = inputFile("src/App.php"); createReportWithAbsolutePath(PhpTestUtils.GENERATED_UT_COVERAGE_REPORT_RELATIVE_PATH, PhpTestUtils.UT_COVERAGE_REPORT_RELATIVE_PATH, inputFile); createReportWithAbsolutePath(PhpTestUtils.GENERATED_IT_COVERAGE_REPORT_RELATIVE_PATH, PhpTestUtils.IT_COVERAGE_REPORT_RELATIVE_PATH, inputFile); createReportWithAbsolutePath(PhpTestUtils.GENERATED_OVERALL_COVERAGE_REPORT_RELATIVE_PATH, PhpTestUtils.OVERALL_COVERAGE_REPORT_RELATIVE_PATH, inputFile); String mainFileKey = inputFile.key(); context.fileSystem().add(inputFile); createSensor().execute(context); assertThat(context.lineHits(mainFileKey, 3)).isEqualTo(3); assertThat(context.lineHits(mainFileKey, 6)).isEqualTo(2); assertThat(context.lineHits(mainFileKey, 7)).isEqualTo(1); }
@Override public void execute(SensorContext context) { FileSystem fileSystem = context.fileSystem(); FilePredicate phpFilePredicate = fileSystem.predicates().hasLanguage(Php.KEY); List<InputFile> inputFiles = new ArrayList<>(); fileSystem.inputFiles(phpFilePredicate).forEach(inputFiles::add); SymbolScanner symbolScanner = new SymbolScanner(context); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } }
PHPSensor implements Sensor { @Override public void execute(SensorContext context) { FileSystem fileSystem = context.fileSystem(); FilePredicate phpFilePredicate = fileSystem.predicates().hasLanguage(Php.KEY); List<InputFile> inputFiles = new ArrayList<>(); fileSystem.inputFiles(phpFilePredicate).forEach(inputFiles::add); SymbolScanner symbolScanner = new SymbolScanner(context); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } } }
PHPSensor implements Sensor { @Override public void execute(SensorContext context) { FileSystem fileSystem = context.fileSystem(); FilePredicate phpFilePredicate = fileSystem.predicates().hasLanguage(Php.KEY); List<InputFile> inputFiles = new ArrayList<>(); fileSystem.inputFiles(phpFilePredicate).forEach(inputFiles::add); SymbolScanner symbolScanner = new SymbolScanner(context); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } } PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter);  PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter, @Nullable PHPCustomRuleRepository[] customRuleRepositories);   PHPSensor(FileLinesContextFactory fileLinesContextFactory, PHPChecks checks, NoSonarFilter noSonarFilter); }
PHPSensor implements Sensor { @Override public void execute(SensorContext context) { FileSystem fileSystem = context.fileSystem(); FilePredicate phpFilePredicate = fileSystem.predicates().hasLanguage(Php.KEY); List<InputFile> inputFiles = new ArrayList<>(); fileSystem.inputFiles(phpFilePredicate).forEach(inputFiles::add); SymbolScanner symbolScanner = new SymbolScanner(context); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } } PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter);  PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter, @Nullable PHPCustomRuleRepository[] customRuleRepositories);   PHPSensor(FileLinesContextFactory fileLinesContextFactory, PHPChecks checks, NoSonarFilter noSonarFilter); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); @Override String toString(); }
PHPSensor implements Sensor { @Override public void execute(SensorContext context) { FileSystem fileSystem = context.fileSystem(); FilePredicate phpFilePredicate = fileSystem.predicates().hasLanguage(Php.KEY); List<InputFile> inputFiles = new ArrayList<>(); fileSystem.inputFiles(phpFilePredicate).forEach(inputFiles::add); SymbolScanner symbolScanner = new SymbolScanner(context); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } } PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter);  PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter, @Nullable PHPCustomRuleRepository[] customRuleRepositories);   PHPSensor(FileLinesContextFactory fileLinesContextFactory, PHPChecks checks, NoSonarFilter noSonarFilter); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); @Override String toString();  }