[ 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/phpunit2/ -> XMLPHPUnit2ResultFormatter.php (source)

   1  <?php
   2  /**
   3   * $Id: XMLPHPUnit2ResultFormatter.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 'PHPUnit2/Framework/Test.php';
  23  require_once 'PHPUnit2/Runner/Version.php';
  24  
  25  require_once 'PHPUnit2/Util/Log/XML.php';
  26  
  27  require_once 'phing/tasks/ext/phpunit2/PHPUnit2ResultFormatter.php';
  28  
  29  /**
  30   * Prints XML output of the test to a specified Writer
  31   *
  32   * @author Michiel Rook <michiel.rook@gmail.com>
  33   * @version $Id: XMLPHPUnit2ResultFormatter.php 3076 2006-12-18 08:52:12Z fabien $
  34   * @package phing.tasks.ext.phpunit2
  35   * @since 2.1.0
  36   */
  37  class XMLPHPUnit2ResultFormatter extends PHPUnit2ResultFormatter
  38  {
  39      private $logger = NULL;
  40      
  41  	function __construct()
  42      {
  43          $this->logger = new PHPUnit2_Util_Log_XML();
  44          $this->logger->setWriteDocument(false);
  45      }
  46      
  47  	function getExtension()
  48      {
  49          return ".xml";
  50      }
  51      
  52  	function getPreferredOutfile()
  53      {
  54          return "testsuites";
  55      }
  56      
  57  	function startTestSuite(PHPUnit2_Framework_TestSuite $suite)
  58      {
  59          parent::startTestSuite($suite);
  60          
  61          $this->logger->startTestSuite($suite);
  62      }
  63      
  64  	function endTestSuite(PHPUnit2_Framework_TestSuite $suite)
  65      {
  66          parent::endTestSuite($suite);
  67          
  68          $this->logger->endTestSuite($suite);
  69      }
  70      
  71  	function startTest(PHPUnit2_Framework_Test $test)
  72      {
  73          parent::startTest($test);
  74          
  75          $this->logger->startTest($test);
  76      }
  77  
  78  	function endTest(PHPUnit2_Framework_Test $test)
  79      {
  80          parent::endTest($test);
  81          
  82          $this->logger->endTest($test);
  83      }
  84      
  85  	function addError(PHPUnit2_Framework_Test $test, Exception $e)
  86      {
  87          parent::addError($test, $e);
  88          
  89          $this->logger->addError($test, $e);
  90      }
  91  
  92  	function addFailure(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $t)
  93      {
  94          parent::addFailure($test, $t);
  95          
  96          $this->logger->addFailure($test, $t);
  97      }
  98  
  99  	function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e)
 100      {
 101          parent::addIncompleteTest($test, $e);
 102          
 103          $this->logger->addIncompleteTest($test, $e);
 104      }
 105      
 106  	function endTestRun()
 107      {
 108          parent::endTestRun();
 109          
 110          if ($this->out)
 111          {
 112              $this->out->write($this->logger->getXML());
 113              $this->out->close();
 114          }
 115      }
 116  }
 117  ?>


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