diff options
author | Josh Hoyt <josh@janrain.com> | 2006-01-06 01:26:35 +0000 |
---|---|---|
committer | Josh Hoyt <josh@janrain.com> | 2006-01-06 01:26:35 +0000 |
commit | 0c589c63f84eab63f3d105ece6a4997f48ba208f (patch) | |
tree | f9ff3c8e53d9d8e641028d2224faf153666d4fac /Tests/TestDriver.php | |
parent | 4a33867cc9fc9c7d4ede561126b31c6774ed947e (diff) | |
download | php-openid-0c589c63f84eab63f3d105ece6a4997f48ba208f.zip php-openid-0c589c63f84eab63f3d105ece6a4997f48ba208f.tar.gz php-openid-0c589c63f84eab63f3d105ece6a4997f48ba208f.tar.bz2 |
[project @ Add function that calls require_once and sets the global variables as if it had been called at the top level.]
Diffstat (limited to 'Tests/TestDriver.php')
-rw-r--r-- | Tests/TestDriver.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Tests/TestDriver.php b/Tests/TestDriver.php index 65db1ce..6986f02 100644 --- a/Tests/TestDriver.php +++ b/Tests/TestDriver.php @@ -13,8 +13,8 @@ * @license http://www.gnu.org/copyleft/lesser.html LGPL */ -require_once('PHPUnit.php'); -require_once('PHPUnit/GUI/HTML.php'); +require_once 'PHPUnit.php'; +require_once 'PHPUnit/GUI/HTML.php'; if (defined('E_STRICT')) { // PHP 5 @@ -106,7 +106,7 @@ function loadTests($test_dir, $test_names) $filename = $test_dir . $filename . '.php'; $class_name = str_replace(DIRECTORY_SEPARATOR, '_', $filename); $class_name = basename($class_name, '.php'); - include_once($filename); + global_require_once($filename); $test = new $class_name($class_name); if (is_a($test, 'PHPUnit_TestCase')) { $test = new PHPUnit_TestSuite($class_name); @@ -117,6 +117,16 @@ function loadTests($test_dir, $test_names) return $suites; } +function global_require_once($name) +{ + require_once($name); + foreach (get_defined_vars() as $k => $v) { + if ($k != 'name') { + $GLOBALS[$k] = $v; + } + } +} + $_test_dir = 'Tests/Net/OpenID/'; $_test_names = array( 'KVForm', |