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

Source for file TestDecorator.php

Documentation is available at TestDecorator.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: TestDecorator.php,v 1.11 2004/12/22 08:06:11 sebastian Exp $
  16. //
  17.  
  18. require_once 'PHPUnit/TestCase.php';
  19. require_once 'PHPUnit/TestSuite.php';
  20.  
  21. /**
  22.  * A Decorator for Tests.
  23.  *
  24.  * Use TestDecorator as the base class for defining new
  25.  * test decorators. Test decorator subclasses can be introduced
  26.  * to add behaviour before or after a test is run.
  27.  *
  28.  * @author      Sebastian Bergmann <sb@sebastian-bergmann.de>
  29.  * @copyright   Copyright &copy; 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
  30.  * @license     http://www.php.net/license/3_0.txt The PHP License, Version 3.0
  31.  * @category    Testing
  32.  * @package     PHPUnit
  33.  */
  34.     /**
  35.     * The Test to be decorated.
  36.     *
  37.     * @var    object 
  38.     * @access protected
  39.     */
  40.     var $_test = NULL;
  41.  
  42.     /**
  43.     * Constructor.
  44.     *
  45.     * @param  object 
  46.     * @access public
  47.     */
  48.     function PHPUnit_TestDecorator(&$test{
  49.         if (is_object($test&&
  50.             (is_a($test'PHPUnit_TestCase'||
  51.              is_a($test'PHPUnit_TestSuite'))) {
  52.  
  53.             $this->_test = $test;
  54.         }
  55.     }
  56.  
  57.     /**
  58.     * Runs the test and collects the
  59.     * result in a TestResult.
  60.     *
  61.     * @param  object 
  62.     * @access public
  63.     */
  64.     function basicRun(&$result{
  65.         $this->_test->run($result);
  66.     }
  67.  
  68.     /**
  69.     * Counts the number of test cases that
  70.     * will be run by this test.
  71.     *
  72.     * @return integer 
  73.     * @access public
  74.     */
  75.     function countTestCases({
  76.         return $this->_test->countTestCases();
  77.     }
  78.  
  79.     /**
  80.     * Returns the test to be run.
  81.     *
  82.     * @return object 
  83.     * @access public
  84.     */
  85.     function &getTest({
  86.         return $this->_test;
  87.     }
  88.  
  89.     /**
  90.     * Runs the decorated test and collects the
  91.     * result in a TestResult.
  92.     *
  93.     * @param  object 
  94.     * @access public
  95.     * @abstract
  96.     */
  97.     function run(&$result/* abstract */ }
  98.  
  99.     /**
  100.     * Returns a string representation of the test.
  101.     *
  102.     * @return string 
  103.     * @access public
  104.     */
  105.     function toString({
  106.         return $this->_test->toString();
  107.     }
  108. }
  109. ?>

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