PHPUnit
[ class tree: PHPUnit ] [ index: PHPUnit ] [ all elements ]

Source for file TestFailure.php

Documentation is available at TestFailure.php

  1. <?php
  2. //
  3. // +------------------------------------------------------------------------+
  4. // | PEAR :: PHPUnit                                                        |
  5. // +------------------------------------------------------------------------+
  6. // | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. |
  7. // +------------------------------------------------------------------------+
  8. // | This source file is subject to version 3.00 of the PHP License,        |
  9. // | that is available at http://www.php.net/license/3_0.txt.               |
  10. // | If you did not receive a copy of the PHP license and are unable to     |
  11. // | obtain it through the world-wide-web, please send a note to            |
  12. // | license@php.net so we can mail you a copy immediately.                 |
  13. // +------------------------------------------------------------------------+
  14. //
  15. // $Id: TestFailure.php,v 1.9 2004/12/22 08:06:11 sebastian Exp $
  16. //
  17.  
  18. /**
  19.  * A TestFailure collects a failed test together with the caught exception.
  20.  *
  21.  * @author      Sebastian Bergmann <sb@sebastian-bergmann.de>
  22.  * @copyright   Copyright &copy; 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
  23.  * @license     http://www.php.net/license/3_0.txt The PHP License, Version 3.0
  24.  * @category    Testing
  25.  * @package     PHPUnit
  26.  */
  27.     /**
  28.     * @var    object 
  29.     * @access private
  30.     */
  31.     var $_failedTest;
  32.  
  33.     /**
  34.     * @var    string 
  35.     * @access private
  36.     */
  37.     var $_thrownException;
  38.  
  39.     /**
  40.     * Constructs a TestFailure with the given test and exception.
  41.     *
  42.     * @param  object 
  43.     * @param  string 
  44.     * @access public
  45.     */
  46.     function PHPUnit_TestFailure(&$failedTest&$thrownException{
  47.         $this->_failedTest      $failedTest;
  48.         $this->_thrownException $thrownException;
  49.     }
  50.  
  51.     /**
  52.     * Gets the failed test.
  53.     *
  54.     * @return object 
  55.     * @access public
  56.     */
  57.     function &failedTest({
  58.         return $this->_failedTest;
  59.     }
  60.  
  61.     /**
  62.     * Gets the thrown exception.
  63.     *
  64.     * @return object 
  65.     * @access public
  66.     */
  67.     function &thrownException({
  68.         return $this->_thrownException;
  69.     }
  70.  
  71.     /**
  72.     * Returns a short description of the failure.
  73.     *
  74.     * @return string 
  75.     * @access public
  76.     */
  77.     function toString({
  78.         return sprintf(
  79.           "TestCase %s->%s() failed: %s\n",
  80.  
  81.           get_class($this->_failedTest),
  82.           $this->_failedTest->getName(),
  83.           $this->_thrownException
  84.         );
  85.     }
  86. }
  87. ?>

Documentation generated on Mon, 11 Mar 2019 14:22:36 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.