[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/phing/tasks/ext/coverage/ -> CoverageMergerTask.php (source)

   1  <?php
   2  /**
   3   * $Id: CoverageMergerTask.php 3076 2006-12-18 08:52:12Z fabien $
   4   *
   5   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   6   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   7   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   8   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   9   * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16   *
  17   * This software consists of voluntary contributions made by many individuals
  18   * and is licensed under the LGPL. For more information please see
  19   * <http://phing.info>.
  20   */
  21  
  22  require_once 'phing/Task.php';
  23  require_once 'phing/system/io/PhingFile.php';
  24  require_once 'phing/system/io/Writer.php';
  25  require_once 'phing/system/util/Properties.php';
  26  require_once 'phing/tasks/ext/coverage/CoverageMerger.php';
  27  
  28  /**
  29   * Merges code coverage snippets into a code coverage database
  30   *
  31   * @author Michiel Rook <michiel.rook@gmail.com>
  32   * @version $Id: CoverageMergerTask.php 3076 2006-12-18 08:52:12Z fabien $
  33   * @package phing.tasks.ext.coverage
  34   * @since 2.1.0
  35   */
  36  class CoverageMergerTask extends Task
  37  {
  38      /** the list of filesets containing the .php filename rules */
  39      private $filesets = array();
  40  
  41      /**
  42       * Add a new fileset containing the .php files to process
  43       *
  44       * @param FileSet the new fileset containing .php files
  45       */
  46  	function addFileSet(FileSet $fileset)
  47      {
  48          $this->filesets[] = $fileset;
  49      }
  50  
  51      /**
  52       * Iterate over all filesets and return all the filenames.
  53       *
  54       * @return array an array of filenames
  55       */
  56  	private function getFilenames()
  57      {
  58          $files = array();
  59  
  60          foreach ($this->filesets as $fileset)
  61          {
  62              $ds = $fileset->getDirectoryScanner($this->project);
  63              $ds->scan();
  64  
  65              $includedFiles = $ds->getIncludedFiles();
  66              
  67              foreach ($includedFiles as $file)
  68              {
  69                  $fs = new PhingFile(basename($ds->getBaseDir()), $file);
  70                      
  71                  $files[] = $fs->getAbsolutePath();
  72              }
  73          }
  74  
  75          return $files;
  76      }
  77      
  78  	function main()
  79      {
  80          $files = $this->getFilenames();
  81          
  82          $this->log("Merging " . count($files) . " coverage files");
  83  
  84          foreach ($files as $file)
  85          {
  86              $coverageInformation = unserialize(file_get_contents($file));
  87              
  88              CoverageMerger::merge($this->project, array($coverageInformation));
  89          }
  90      }
  91  }
  92  ?>


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7