Back to index

php5  5.3.10
Public Member Functions | Public Attributes | Protected Attributes
PEAR2\Pyrus\Developer\CoverageAnalyzer\Aggregator Class Reference

List of all members.

Public Member Functions

 __construct ($testpath, $codepath, $db= ':memory:')
 retrieveLineLinks ($file)
 retrievePaths ()
 retrievePathsForTest ($test)
 retrieveTestPaths ()
 coveragePercentage ($sourcefile, $testfile=null)
 coverageInfo ($path)
 coverageInfoByTest ($path, $test)
 retrieveCoverage ($path)
 retrieveCoverageByTest ($path, $test)
 retrieveXdebug ($path, $testid)
 scan ($testpath)
 render ($toPath)

Public Attributes

 $totallines = 0
 $totalcoveredlines = 0

Protected Attributes

 $codepath
 $testpath
 $sqlite

Detailed Description

Definition at line 739 of file pear2coverage.phar.php.


Constructor & Destructor Documentation

PEAR2\Pyrus\Developer\CoverageAnalyzer\Aggregator::__construct ( testpath,
codepath,
db = ':memory:' 
)

Definition at line 751 of file pear2coverage.phar.php.

                           {
            if (!strpos($codepath, '://') || !file_exists($codepath)) {
                // stream wrapper not found
                throw new Exception('Can not find code path $codepath');
            }
        } else {
            $codepath = $newcodepath;
        }
        $this->sqlite = new Sqlite($db, $codepath, $testpath);
        $this->codepath = $codepath;
        $this->sqlite->begin();
        echo "Scanning for xdebug coverage files...";
        $files = $this->scan($testpath);
        echo "done\n";
        $infostring = '';
        echo "Parsing xdebug results\n";
        if (count($files)) {
            foreach ($files as $testid => $xdebugfile) {
                if (!file_exists(str_replace('.xdebug', '.phpt', $xdebugfile))) {
                    echo "\nWARNING: outdated .xdebug file $xdebugfile, delete this relic\n";
                    continue;
                }
                $id = $this->sqlite->addTest(str_replace('.xdebug', '.phpt', $xdebugfile));
                echo '(' . $testid . ' of ' . count($files) . ') ' . $xdebugfile;
                $this->retrieveXdebug($xdebugfile, $id);
                echo "done\n";
            }
            echo "done\n";
            $this->sqlite->updateTotalCoverage();
            $this->sqlite->commit();
        } else {
            echo "done (no modified xdebug files)\n";
        }
    }

    function retrieveLineLinks($file)

Here is the call graph for this function:


Member Function Documentation

Definition at line 814 of file pear2coverage.phar.php.

    {

Definition at line 819 of file pear2coverage.phar.php.

    {

Definition at line 809 of file pear2coverage.phar.php.

    {

Definition at line 902 of file pear2coverage.phar.php.

                                                 {

Definition at line 824 of file pear2coverage.phar.php.

    {

Definition at line 829 of file pear2coverage.phar.php.

    {

Definition at line 789 of file pear2coverage.phar.php.

    {

Definition at line 794 of file pear2coverage.phar.php.

    {

Definition at line 799 of file pear2coverage.phar.php.

    {

Here is the caller graph for this function:

Definition at line 804 of file pear2coverage.phar.php.

    {

Here is the caller graph for this function:

Definition at line 834 of file pear2coverage.phar.php.

    {

Definition at line 841 of file pear2coverage.phar.php.

                        {
            throw new Exception('Unable to process path' . $a);
        }
        $testpath = str_replace('\\', '/', $testpath);
        $this->testpath = $testpath;

        // first get a list of all directories
        $dirs = $globdirs = array();
        $index = 0;
        $dir = $testpath;
        do {
            $globdirs = glob($dir . '/*', GLOB_ONLYDIR);
            if ($globdirs) {
                $dirs = array_merge($dirs, $globdirs);
                $dir = $dirs[$index++];
            } else {
                while (!isset($dirs[$index++]) && $index <= count($dirs));
                if (isset($dirs[$index])) {
                    $dir = $dirs[$index];
                }
            }
        } while ($index <= count($dirs));

        // then find all code coverage files
        $xdebugs = array();
        foreach ($dirs as $dir) {
            $globbie = glob($dir . '/*.xdebug');
            $xdebugs = array_merge($xdebugs, $globbie);
        }
        $xdebugs = array_unique($xdebugs);
        $modified = array();
        $unmodified = array();
        foreach ($xdebugs as $path) {
            if ($this->sqlite->unChangedXdebug($path)) {
                $unmodified[$path] = true;
                continue;
            }
            $modified[] = $path;
        }
        $xdebugs = $modified;
        sort($xdebugs);
        // index from 1
        array_unshift($xdebugs, '');
        unset($xdebugs[0]);
        $test = array_flip($xdebugs);
        foreach ($this->sqlite->retrieveTestPaths() as $path) {
            $xdebugpath = str_replace('.phpt', '.xdebug', $path);
            if (isset($test[$xdebugpath]) || isset($unmodified[$xdebugpath])) {
                continue;
            }
            // remove outdated tests
            echo "Removing results from $xdebugpath\n";
            $this->sqlite->removeOldTest($path, $xdebugpath);
        }
        return $xdebugs;
    }

    function render($toPath)

Here is the call graph for this function:


Member Data Documentation

Definition at line 741 of file pear2coverage.phar.php.

Definition at line 743 of file pear2coverage.phar.php.

Definition at line 742 of file pear2coverage.phar.php.

Definition at line 745 of file pear2coverage.phar.php.

Definition at line 744 of file pear2coverage.phar.php.


The documentation for this class was generated from the following file: