<?php

xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$base_directory = dirname(__FILE__) . '/../../';
require_once $base_directory . 'NaithCliRunner.class.php';
require_once $base_directory . 'NaithCliReport.class.php';
require_once $base_directory . 'NaithJunitReport.class.php';
$coverage_file_path = dirname(__FILE__) . '/raw_coverage_file.txt';
$tests_report_path = dirname(__FILE__) . '/tests_report_raw.txt';
$junit_xml_path = dirname(__FILE__) . '/junit.xml';
register_shutdown_function('NaithCliRunner::onShutdown');
$junit_report = new NaithJunitReport(array('excluded_paths' => array(dirname(__FILE__) . '/tests/not_fully_tested.php'), 'tests_report_path' => $tests_report_path, 'base_directory' => $base_directory));
$junit_report->writeJunitXmlToFile($junit_xml_path);
echo file_get_contents($junit_xml_path);
NaithCliRunner::setCoverageFilePath($coverage_file_path);
NaithCliRunner::bootstrapForTest();
$report = new NaithCliReport(array('coverage_file_path' => $coverage_file_path, 'excluded_paths' => array(dirname(__FILE__)), 'minimum_code_coverage' => 0, 'base_directory' => $base_directory));
$report->makeUntestedCodeOverview();
$report->makeCoverageOverview();
$report = new NaithCliReport(array('coverage_file_path' => $coverage_file_path, 'excluded_paths' => array(dirname(__FILE__)), 'minimum_code_coverage' => 120, 'base_directory' => $base_directory));
$report->makeUntestedCodeOverview();
$report->makeCoverageOverview();
Beispiel #2
0
    }
    $minimum_code_coverage = 0;
    if (isset($options['minimum_code_coverage'])) {
        list($minimum_code_coverage) = $options['minimum_code_coverage'];
    }
    $base_directory = dirname(getcwd());
    if (isset($options['base_directory'])) {
        list($base_directory) = $options['base_directory'];
    }
    list($coverage_file_path) = $options['coverage_file_path'];
    $report = new NaithCliReport(array('base_directory' => $base_directory, 'excluded_paths' => $excluded_paths, 'coverage_file_path' => $coverage_file_path, 'minimum_code_coverage' => $minimum_code_coverage));
}
switch ($action_name) {
    case "run-test":
        if (isset($options['coverage_file_path'])) {
            NaithCliRunner::setCoverageFilePath($options['coverage_file_path'][0]);
        }
        if (isset($options['tests_report_path'])) {
            NaithCliRunner::setTestsReportPath($options['tests_report_path'][0], $options['test_file'][0]);
        }
        NaithCliRunner::bootstrapForTest();
        if (isset($options['prepend_file'])) {
            foreach ($options['prepend_file'] as $prepended_file) {
                require $prepended_file;
            }
        }
        if (isset($options['test_file'])) {
            foreach ($options['test_file'] as $test_file) {
                require $test_file;
            }
        }