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

Source for file TestListener.php

Documentation is available at TestListener.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: TestListener.php,v 1.9 2004/12/22 08:06:11 sebastian Exp $
  16. //
  17.  
  18. /**
  19.  * A Listener for test progress.
  20.  *
  21.  * Here is an example:
  22.  *
  23.  * <code>
  24.  * <?php
  25.  * require_once 'PHPUnit.php';
  26.  * require_once 'PHPUnit/TestListener.php';
  27.  *
  28.  * class MathTest extends PHPUnit_TestCase {
  29.  *     var $fValue1;
  30.  *     var $fValue2;
  31.  *
  32.  *     function MathTest($name) {
  33.  *         $this->PHPUnit_TestCase($name);
  34.  *     }
  35.  *
  36.  *     function setUp() {
  37.  *         $this->fValue1 = 2;
  38.  *         $this->fValue2 = 3;
  39.  *     }
  40.  *
  41.  *     function testAdd() {
  42.  *         $this->assertTrue($this->fValue1 + $this->fValue2 == 4);
  43.  *     }
  44.  * }
  45.  *
  46.  * class MyListener extends PHPUnit_TestListener {
  47.  *     function addError(&$test, &$t) {
  48.  *         print "MyListener::addError() called.\n";
  49.  *     }
  50.  *
  51.  *     function addFailure(&$test, &$t) {
  52.  *         print "MyListener::addFailure() called.\n";
  53.  *     }
  54.  *
  55.  *     function endTest(&$test) {
  56.  *         print "MyListener::endTest() called.\n";
  57.  *     }
  58.  *
  59.  *     function startTest(&$test) {
  60.  *         print "MyListener::startTest() called.\n";
  61.  *     }
  62.  * }
  63.  *
  64.  * $suite = new PHPUnit_TestSuite;
  65.  * $suite->addTest(new MathTest('testAdd'));
  66.  *
  67.  * $result = new PHPUnit_TestResult;
  68.  * $result->addListener(new MyListener);
  69.  *
  70.  * $suite->run($result);
  71.  * print $result->toString();
  72.  * ?>
  73.  * </code>
  74.  *
  75.  * @author      Sebastian Bergmann <sb@sebastian-bergmann.de>
  76.  * @copyright   Copyright &copy; 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
  77.  * @license     http://www.php.net/license/3_0.txt The PHP License, Version 3.0
  78.  * @category    Testing
  79.  * @package     PHPUnit
  80.  */
  81.     /**
  82.     * An error occurred.
  83.     *
  84.     * @param  object 
  85.     * @param  object 
  86.     * @access public
  87.     * @abstract
  88.     */
  89.     function addError(&$test&$t/*abstract */ }
  90.  
  91.     /**
  92.     * A failure occurred.
  93.     *
  94.     * @param  object 
  95.     * @param  object 
  96.     * @access public
  97.     * @abstract
  98.     */
  99.     function addFailure(&$test&$t/*abstract */ }
  100.  
  101.     /**
  102.     * A test ended.
  103.     *
  104.     * @param  object 
  105.     * @access public
  106.     * @abstract
  107.     */
  108.     function endTest(&$test/*abstract */ }
  109.  
  110.     /**
  111.     * A test started.
  112.     *
  113.     * @param  object 
  114.     * @access public
  115.     * @abstract
  116.     */
  117.     function startTest(&$test/*abstract */ }
  118. }
  119. ?>

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