svn: /pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/ Aggregator.php

[email protected] (Brett Bieber)
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
saltybeagle                              Wed, 26 May 2010 16:47:44 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299801

Log:
Message improvements and readability fixes from Helgi.

Changed paths:
    U   pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/Aggregator.php

Modified: pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/Aggregator.php
===================================================================
--- pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/Aggregator.php	2010-05-26 16:46:33 UTC (rev 299800)
+++ pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/Aggregator.php	2010-05-26 16:47:44 UTC (rev 299801)
@@ -40,10 +40,11 @@
         $this->sqlite = new Sqlite($db, $codepath, $testpath, $files);
         $this->codepath = $codepath;
         $this->sqlite->begin();
-        echo "Scanning for xdebug coverage files...";
+
+        echo "Scanning for xdebug coverage files...\n";
         $files = $this->scan($testpath);
         echo "done\n";
-        $infostring = '';
+
         echo "Parsing xdebug results\n";
         if (!count($files)) {
             echo "done (no modified xdebug files)\n";
@@ -61,20 +62,21 @@
             $id = $this->sqlite->addTest($phpt);
             echo '(' . $testid . ' of ' . count($files) . ') ' . $xdebugfile;
             $this->retrieveXdebug($xdebugfile, $id);
-            echo "done\n";
+            echo "\ndone\n";
         }

-        echo "done\n";
         $this->sqlite->addNoCoverageFiles();
         $this->sqlite->updateAllLines();
         $this->sqlite->updateTotalCoverage();
         $this->sqlite->commit();

         if (count($delete)) {
-            echo "\nWARNING: The following .xdebug files are outdated relics and should be deleted\n";
+            echo "\nNote: The following .xdebug files were outdated relics and have been deleted\n";
             foreach ($delete as $d) {
+                unlink($d);
                 echo "$d\n";
             }
+            echo "\n";
         }
     }

@@ -139,31 +141,30 @@
         $this->sqlite->addCoverage(str_replace('.xdebug', '.phpt', $path), $testid, $xdebug);
     }

-    function scan($testpath)
+    function scan($path)
     {
-        $a = $testpath;
-        $testpath = realpath($testpath);
+        $testpath = realpath($path);
         if (!$testpath) {
-            throw new Exception('Unable to process path' . $a);
+            throw new Exception('Unable to process path' . $path);
         }

-        $testpath = str_replace('\\', '/', $testpath);
-        $this->testpath = $testpath;
+        $this->testpath = str_replace('\\', '/', $testpath);

         // get a list of all xdebug files
         $xdebugs = array();
         foreach (new \RegexIterator(
-                                    new \RecursiveIteratorIterator(
-                                        new \RecursiveDirectoryIterator($testpath,
-                                                                        0|\RecursiveDirectoryIterator::SKIP_DOTS)),
-                                    '/\.xdebug$/') as $file) {
+                    new \RecursiveIteratorIterator(
+                        new \RecursiveDirectoryIterator($this->testpath,
+                                                        0|\RecursiveDirectoryIterator::SKIP_DOTS)
+                    ), '/\.xdebug$/') as $file
+        ) {
             if (strpos((string) $file, '.svn')) {
                 continue;
             }

             $xdebugs[] = realpath((string) $file);
         }
-        echo count($xdebugs), ' total...';
+        echo count($xdebugs), " total...\n";

         $unmodified = $modified = array();
         foreach ($xdebugs as $path) {
@@ -200,13 +201,13 @@
     function render($toPath)
     {
         $decorator = new DefaultSourceDecorator($toPath, $this->testpath, $this->codepath);
-        echo "Generating project coverage data...";
+        echo "Generating project coverage data...\n";
         $coverage = $this->sqlite->retrieveProjectCoverage();
         echo "done\n";
         $decorator->renderSummary($this, $this->retrievePaths(), $this->codepath, false, $coverage[1],
                                   $coverage[0], $coverage[2]);
         $a = $this->codepath;
-        echo "[Step 2 of 2] Rendering per-test coverage...";
+        echo "[Step 2 of 2] Rendering per-test coverage...\n";
         $decorator->renderTestCoverage($this, $this->testpath, $a);
         echo "done\n";
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.