Exemple #1
0
 function AllTests()
 {
     $reporter = new HtmlCoverageReporter("CASHMusic Code Coverage", "", "report");
     $includePaths = array("core", "installers", "interface");
     $excludePaths = array("tests");
     $cov = new CoverageRecorder($includePaths, $excludePaths, $reporter);
     $cov->startInstrumentation();
     $this->TestSuite('All tests');
     // this sucks. We should auto-add anything in tests/php/*.php
     $this->addFile('tests/php/001_BasicTests.php');
     $this->addFile('tests/php/002_CASHConnection.php');
     // $this->addFile('tests/php/003_CASHDBA.php');
     // Since test failures stop the test suite, if we get here, all
     // tests passed. This lets Jitterbug know what is up.
     print "Result: PASS\n";
     // this is probably not the right place for this
     $cov->stopInstrumentation();
     $cov->generateReport();
     $reporter->printTextSummary();
 }
Exemple #2
0
 * This file should be executed with following command
 * Linux:
 *   $ (export PHPCOVERAGE_HOME=/path/to/phpcoverage/src; php codeCoverageMain.php)
 * Windows: 
 *   > set PHPCOVERAGE_HOME=/path/to/phpcoverage/src
 *   > php codeCoverageMain.php
 *
 */
#require_once "phpcoverage.inc.php";
#define("PHPCOVERAGE_HOME", "/var/git/gus-dev/php/http/phpcoverage/src");
define("PHPCOVERAGE_HOME", "../../src");
require_once PHPCOVERAGE_HOME . "/CoverageRecorder.php";
require_once PHPCOVERAGE_HOME . "/reporter/HtmlCoverageReporter.php";
$reporter = new HtmlCoverageReporter("Code Coverage Report", "", "report");
#$includePaths = array(".");
#$excludePaths = array("codeCoverageMain.php", "test_driver.php");
#$includePaths = array("/var/git/gus-dev/php/http/system/application/controllers/" . $argv[1] . ".php");
if ($argv[1] == "test") {
    $includePaths = array("../../../system/application/controllers/" . $argv[1] . ".php", "../../../system/application/models/");
} else {
    $includePaths = array("../../../system/application/controllers/" . $argv[1] . ".php");
}
$excludePaths = array("");
$cov = new CoverageRecorder($includePaths, $excludePaths, $reporter);
$cov->startInstrumentation();
#include "test_driver.php";
#include "/var/git/gus-dev/php/http/index.php";
include "../../../index.php";
$cov->stopInstrumentation();
$cov->generateReport();
$reporter->printTextSummary();
 /** 
  * Generate report from the xml coverage data
  * The preferred method for usage of this function is 
  * passing a stream of the XML data in. This is much more
  * efficient and consumes less memory. 
  * 
  * @param $xmlUrl Url where XML data is available or string
  * @param $stream=false Is the xml available as stream? 
  * @access public
  */
 public function generateReport($xmlUrl, $stream = false)
 {
     $this->logger->debug("XML Url: " . $xmlUrl, __FILE__, __LINE__);
     $this->parseCoverageXml($xmlUrl, true);
     $this->logger->debug("Coverage Data final: " . print_r($this->coverageData, true));
     parent::generateReport();
 }
Exemple #4
0
<?php

require 'simpletest/unit_tester.php';
require 'simpletest/mock_objects.php';
require 'simpletest/reporter.php';
define('MIO_PATH', realpath(dirname(__FILE__) . '/../') . '/');
require 'spikecoverage/CoverageRecorder.php';
require 'spikecoverage/reporter/HtmlCoverageReporter.php';
$coverage_reporter = new HtmlCoverageReporter("Code Coverage Report", "", "reports");
$include = array(MIO_PATH);
$exclude = array(MIO_PATH . "tests", MIO_PATH . "example");
$coverage_recorder = new CoverageRecorder($include, $exclude, $coverage_reporter);
$group = new GroupTest('All Muliplexing I/O Tests');
$dir = opendir(MIO_PATH . '/tests');
while ($file = readdir($dir)) {
    if (is_file($file) && substr($file, 0, 1) != '.' && $file != 'testRunner.php') {
        require MIO_PATH . 'tests/' . $file;
        $class = 'Mio' . substr($file, 0, -4);
        $group->addTestClass(new $class());
    }
}
$coverage_recorder->startInstrumentation();
$group->run(new TextReporter());
$coverage_recorder->stopInstrumentation();
$coverage_recorder->generateReport();
$coverage_reporter->printTextSummary();
Exemple #5
0
<?php

@define('__PHPCOVERAGE_HOME', dirname(__FILE__) . '/../../lib/spikephpcoverage/src/');
require_once __PHPCOVERAGE_HOME . '/CoverageRecorder.php';
require_once dirname(__FILE__) . '/../../src/lmbSummaryCoverageReporter.class.php';
$coverage_include = array('src');
$coverage_exclude = array();
$coverage_reporter = new lmbSummaryCoverageReporter();
$coverage = new CoverageRecorder($coverage_include, $coverage_exclude, $coverage_reporter);
$coverage->startInstrumentation();
include 'src/a.php';
include 'src/b.php';
$coverage->stopInstrumentation();
$coverage->generateReport();
$coverage_reporter->printTextSummary();