[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/test/PHPUnit/ -> TestFailure.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   3  
   4  /**
   5   * PHP Version 4
   6   *
   7   * Copyright (c) 2002-2005, Sebastian Bergmann <sb@sebastian-bergmann.de>.
   8   * All rights reserved.
   9   *
  10   * Redistribution and use in source and binary forms, with or without
  11   * modification, are permitted provided that the following conditions
  12   * are met:
  13   *
  14   *   * Redistributions of source code must retain the above copyright
  15   *     notice, this list of conditions and the following disclaimer.
  16   * 
  17   *   * Redistributions in binary form must reproduce the above copyright
  18   *     notice, this list of conditions and the following disclaimer in
  19   *     the documentation and/or other materials provided with the
  20   *     distribution.
  21   *
  22   *   * Neither the name of Sebastian Bergmann nor the names of his
  23   *     contributors may be used to endorse or promote products derived
  24   *     from this software without specific prior written permission.
  25   *
  26   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  27   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  28   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  29   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  30   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  31   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  32   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  33   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  34   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
  35   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  36   * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  37   * POSSIBILITY OF SUCH DAMAGE.
  38   *
  39   * @category   Testing
  40   * @package    PHPUnit
  41   * @author     Sebastian Bergmann <sb@sebastian-bergmann.de>
  42   * @copyright  2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
  43   * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
  44   * @version    CVS: $Id: TestFailure.php,v 1.13 2005/11/10 09:47:14 sebastian Exp $
  45   * @link       http://pear.php.net/package/PHPUnit
  46   * @since      File available since Release 1.0.0
  47   */
  48  
  49  /**
  50   * A TestFailure collects a failed test together with the caught exception.
  51   *
  52   * @category   Testing
  53   * @package    PHPUnit
  54   * @author     Sebastian Bergmann <sb@sebastian-bergmann.de>
  55   * @copyright  2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
  56   * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
  57   * @version    Release: @package_version@
  58   * @link       http://pear.php.net/package/PHPUnit
  59   * @since      Class available since Release 1.0.0
  60   */
  61  class PHPUnit_TestFailure {
  62      /**
  63       * @var    object
  64       * @access private
  65       */
  66      var $_failedTest;
  67  
  68      /**
  69       * @var    string
  70       * @access private
  71       */
  72      var $_thrownException;
  73  
  74      /**
  75       * Constructs a TestFailure with the given test and exception.
  76       *
  77       * @param  object
  78       * @param  string
  79       * @access public
  80       */
  81      function PHPUnit_TestFailure(&$failedTest, &$thrownException) {
  82          $this->_failedTest      = &$failedTest;
  83          $this->_thrownException = &$thrownException;
  84      }
  85  
  86      /**
  87       * Gets the failed test.
  88       *
  89       * @return object
  90       * @access public
  91       */
  92      function &failedTest() {
  93          return $this->_failedTest;
  94      }
  95  
  96      /**
  97       * Gets the thrown exception.
  98       *
  99       * @return object
 100       * @access public
 101       */
 102      function &thrownException() {
 103          return $this->_thrownException;
 104      }
 105  
 106      /**
 107       * Returns a short description of the failure.
 108       *
 109       * @return string
 110       * @access public
 111       */
 112      function toString() {
 113          return sprintf(
 114            "TestCase %s->%s() failed: %s\n",
 115  
 116            get_class($this->_failedTest),
 117            $this->_failedTest->getName(),
 118            $this->_thrownException
 119          );
 120      }
 121  }
 122  
 123  /*
 124   * Local variables:
 125   * tab-width: 4
 126   * c-basic-offset: 4
 127   * c-hanging-comment-ender-p: nil
 128   * End:
 129   */
 130  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics