Files
simpletest
docs
extensions
test
HELP_MY_TESTS_DONT_WORK_ANYMORE
LICENSE
README
VERSION
authentication.php
autorun.php
browser.php
collector.php
compatibility.php
cookies.php
default_reporter.php
detached.php
dumper.php
eclipse.php
encoding.php
errors.php
exceptions.php
expectation.php
form.php
frames.php
http.php
invoker.php
mock_objects.php
page.php
parser.php
reflection_php4.php
reflection_php5.php
remote.php
reporter.php
scorer.php
selector.php
shell_tester.php
simpletest.php
socket.php
tag.php
test_case.php
unit_tester.php
url.php
user_agent.php
web_tester.php
xml.php
XMLDBtestUnit.php
XMLSQL.php
database.xml
database2.xml
log.php
Chouchen 69b9eb42e2 More SQL command (drop table, drop database)
delete, select & insert upgraded 
More utility function (node to array, arrayToNode)
XMLDB special move command
PHP Unit Test
2010-10-11 14:03:38 +00:00

139 lines
3.5 KiB
PHP

<?php
/**
* Base include file for SimpleTest
* @package SimpleTest
* @subpackage UnitTester
* @version $Id: invoker.php 1722 2008-04-07 19:30:56Z lastcraft $
*/
/**#@+
* 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 {
var $_test_case;
/**
* Stashes the test case for later.
* @param SimpleTestCase $test_case Test case to run.
*/
function SimpleInvoker(&$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 {
var $_invoker;
/**
* Stores the invoker to wrap.
* @param SimpleInvoker $invoker Test method runner.
*/
function SimpleInvokerDecorator(&$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);
}
}
?>