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

Source for file TestSetup.php

Documentation is available at TestSetup.php

  1. <?php
  2. //
  3. // +------------------------------------------------------------------------+
  4. // | PEAR :: PHPUnit2                                                       |
  5. // +------------------------------------------------------------------------+
  6. // | Copyright (c) 2002-2004 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: TestSetup.php,v 1.4 2004/05/26 06:24:04 sebastian Exp $
  16. //
  17.  
  18. require_once 'PHPUnit2/Framework/TestResult.php';
  19. require_once 'PHPUnit2/Extensions/TestDecorator.php';
  20.  
  21. /**
  22.  * A Decorator to set up and tear down additional fixture state.
  23.  * Subclass TestSetup and insert it into your tests when you want
  24.  * to set up additional state once before the tests are run.
  25.  *
  26.  * @author      Sebastian Bergmann <sb@sebastian-bergmann.de>
  27.  * @copyright   Copyright &copy; 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>
  28.  * @license     http://www.php.net/license/3_0.txt The PHP License, Version 3.0
  29.  * @category    PHP
  30.  * @package     PHPUnit2
  31.  * @subpackage  Extensions
  32.  */
  33.     // {{{ public function run($result = null)
  34.  
  35.     /**
  36.     * Runs the decorated test and collects the
  37.     * result in a TestResult.
  38.     *
  39.     * @param  PHPUnit2_Framework_TestResult $result 
  40.     * @return PHPUnit2_Framework_TestResult 
  41.     * @access public
  42.     */
  43.     public function run($result = null{
  44.         if ($result === null{
  45.             $result $this->createResult();
  46.         }
  47.  
  48.         // XXX: Workaround for missing optional class type hints.
  49.         else if (!($result instanceof PHPUnit2_Framework_TestResult)) {
  50.             throw new Exception(
  51.               'Argument 1 must be an instance of PHPUnit2_Framework_TestResult.'
  52.             );
  53.         }
  54.  
  55.         $this->setUp();
  56.         $this->basicRun($result);
  57.         $this->tearDown();
  58.  
  59.         return $result;
  60.     }
  61.  
  62.     // }}}
  63.     // {{{ protected function setUp()
  64.  
  65.     /**
  66.     * Sets up the fixture. Override to set up additional fixture
  67.     * state.
  68.     *
  69.     * @access protected
  70.     */
  71.     protected function setUp({}
  72.  
  73.     // }}}
  74.     // {{{ protected function tearDown()
  75.  
  76.     /**
  77.     * Tears down the fixture. Override to tear down the additional
  78.     * fixture state.
  79.     *
  80.     * @access protected
  81.     */
  82.     protected function tearDown({}
  83.  
  84.     // }}}
  85. }
  86.  
  87. /*
  88.  * vim600:  et sw=2 ts=2 fdm=marker
  89.  * vim<600: et sw=2 ts=2
  90.  */
  91. ?>

Documentation generated on Mon, 11 Mar 2019 13:55:59 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.