diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-02-16 09:44:49 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-02-16 09:44:49 +0100 |
commit | 20553c1afe035b2e020409fd516d0288b748dc7f (patch) | |
tree | 9b7cc32ee2560d86315339b9716c1a790a680afc /3rdparty/simpletest/invoker.php | |
parent | 19827b8b35de6192d54bf7600e9e29800c93b21b (diff) | |
download | nextcloud-server-20553c1afe035b2e020409fd516d0288b748dc7f.tar.gz nextcloud-server-20553c1afe035b2e020409fd516d0288b748dc7f.zip |
Revert "remove the 3rdparty files. everything is now in https://gitorious.org/owncloud/3rdparty"
This reverts commit dccdeca2581f705c69eb4266aa646173f588a9de.
Diffstat (limited to '3rdparty/simpletest/invoker.php')
-rwxr-xr-x | 3rdparty/simpletest/invoker.php | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/3rdparty/simpletest/invoker.php b/3rdparty/simpletest/invoker.php new file mode 100755 index 00000000000..ee310343fc7 --- /dev/null +++ b/3rdparty/simpletest/invoker.php @@ -0,0 +1,139 @@ +<?php +/** + * Base include file for SimpleTest + * @package SimpleTest + * @subpackage UnitTester + * @version $Id: invoker.php 1785 2008-04-26 13:56:41Z pp11 $ + */ + +/**#@+ + * Includes SimpleTest files and defined the root constant + * for dependent libraries. + */ +require_once(dirname(__FILE__) . '/errors.php'); +require_once(dirname(__FILE__) . '/compatibility.php'); +require_once(dirname(__FILE__) . '/scorer.php'); +require_once(dirname(__FILE__) . '/expectation.php'); +require_once(dirname(__FILE__) . '/dumper.php'); +if (! defined('SIMPLE_TEST')) { + define('SIMPLE_TEST', dirname(__FILE__) . '/'); +} +/**#@-*/ + +/** + * This is called by the class runner to run a + * single test method. Will also run the setUp() + * and tearDown() methods. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleInvoker { + private $test_case; + + /** + * Stashes the test case for later. + * @param SimpleTestCase $test_case Test case to run. + */ + function __construct($test_case) { + $this->test_case = $test_case; + } + + /** + * Accessor for test case being run. + * @return SimpleTestCase Test case. + * @access public + */ + function getTestCase() { + return $this->test_case; + } + + /** + * Runs test level set up. Used for changing + * the mechanics of base test cases. + * @param string $method Test method to call. + * @access public + */ + function before($method) { + $this->test_case->before($method); + } + + /** + * Invokes a test method and buffered with setUp() + * and tearDown() calls. + * @param string $method Test method to call. + * @access public + */ + function invoke($method) { + $this->test_case->setUp(); + $this->test_case->$method(); + $this->test_case->tearDown(); + } + + /** + * Runs test level clean up. Used for changing + * the mechanics of base test cases. + * @param string $method Test method to call. + * @access public + */ + function after($method) { + $this->test_case->after($method); + } +} + +/** + * Do nothing decorator. Just passes the invocation + * straight through. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleInvokerDecorator { + private $invoker; + + /** + * Stores the invoker to wrap. + * @param SimpleInvoker $invoker Test method runner. + */ + function __construct($invoker) { + $this->invoker = $invoker; + } + + /** + * Accessor for test case being run. + * @return SimpleTestCase Test case. + * @access public + */ + function getTestCase() { + return $this->invoker->getTestCase(); + } + + /** + * Runs test level set up. Used for changing + * the mechanics of base test cases. + * @param string $method Test method to call. + * @access public + */ + function before($method) { + $this->invoker->before($method); + } + + /** + * Invokes a test method and buffered with setUp() + * and tearDown() calls. + * @param string $method Test method to call. + * @access public + */ + function invoke($method) { + $this->invoker->invoke($method); + } + + /** + * Runs test level clean up. Used for changing + * the mechanics of base test cases. + * @param string $method Test method to call. + * @access public + */ + function after($method) { + $this->invoker->after($method); + } +} +?>
\ No newline at end of file |