summaryrefslogtreecommitdiff
path: root/tests/test_tools/simpletest/options.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_tools/simpletest/options.php')
-rw-r--r--tests/test_tools/simpletest/options.php88
1 files changed, 44 insertions, 44 deletions
diff --git a/tests/test_tools/simpletest/options.php b/tests/test_tools/simpletest/options.php
index e110fc45..e4bc97ea 100644
--- a/tests/test_tools/simpletest/options.php
+++ b/tests/test_tools/simpletest/options.php
@@ -4,24 +4,24 @@
* @package SimpleTest
* @version $Id$
*/
-
+
/**
* Static global directives and options.
* @package SimpleTest
*/
class SimpleTestOptions {
-
+
/**
* Reads the SimpleTest version from the release file.
* @return string Version string.
* @static
* @access public
*/
- function getVersion() {
+ static function getVersion() {
$content = file(dirname(__FILE__) . '/VERSION');
return trim($content[0]);
}
-
+
/**
* Sets the name of a test case to ignore, usually
* because the class is an abstract case that should
@@ -30,11 +30,11 @@
* @static
* @access public
*/
- function ignore($class) {
+ static function ignore($class) {
$registry =SimpleTestOptions::_getRegistry();
$registry['IgnoreList'][] = strtolower($class);
}
-
+
/**
* Test to see if a test case is in the ignore
* list.
@@ -43,11 +43,11 @@
* @access public
* @static
*/
- function isIgnored($class) {
+ static function isIgnored($class) {
$registry =SimpleTestOptions::_getRegistry();
return in_array(strtolower($class), $registry['IgnoreList']);
}
-
+
/**
* The base class name is settable here. This is the
* class that a new stub will inherited from.
@@ -58,22 +58,22 @@
* @static
* @access public
*/
- function setStubBaseClass($stub_base) {
+ static function setStubBaseClass($stub_base) {
$registry =SimpleTestOptions::_getRegistry();
$registry['StubBaseClass'] = $stub_base;
}
-
+
/**
* Accessor for the currently set stub base class.
* @return string Class name to inherit from.
* @static
* @access public
*/
- function getStubBaseClass() {
+ static function getStubBaseClass() {
$registry =SimpleTestOptions::_getRegistry();
return $registry['StubBaseClass'];
}
-
+
/**
* The base class name is settable here. This is the
* class that a new mock will inherited from.
@@ -84,22 +84,22 @@
* @static
* @access public
*/
- function setMockBaseClass($mock_base) {
+ static function setMockBaseClass($mock_base) {
$registry =SimpleTestOptions::_getRegistry();
$registry['MockBaseClass'] = $mock_base;
}
-
+
/**
* Accessor for the currently set mock base class.
* @return string Class name to inherit from.
* @static
* @access public
*/
- function getMockBaseClass() {
+ static function getMockBaseClass() {
$registry =SimpleTestOptions::_getRegistry();
return $registry['MockBaseClass'];
}
-
+
/**
* Adds additional mock code.
* @param string $code Extra code that can be added
@@ -109,11 +109,11 @@
* the mock base classes.
* @access public
*/
- function addPartialMockCode($code = '') {
+ static function addPartialMockCode($code = '') {
$registry =SimpleTestOptions::_getRegistry();
$registry['AdditionalPartialMockCode'] = $code;
}
-
+
/**
* Accessor for additional partial mock code.
* @return string Extra code.
@@ -123,7 +123,7 @@
$registry =SimpleTestOptions::_getRegistry();
return $registry['AdditionalPartialMockCode'];
}
-
+
/**
* Sets proxy to use on all requests for when
* testing from behind a firewall. Set host
@@ -134,13 +134,13 @@
* @param string $password Proxy password for authentication.
* @access public
*/
- function useProxy($proxy, $username = false, $password = false) {
+ static function useProxy($proxy, $username = false, $password = false) {
$registry =SimpleTestOptions::_getRegistry();
$registry['DefaultProxy'] = $proxy;
$registry['DefaultProxyUsername'] = $username;
$registry['DefaultProxyPassword'] = $password;
}
-
+
/**
* Accessor for default proxy host.
* @return string Proxy URL.
@@ -150,7 +150,7 @@
$registry =SimpleTestOptions::_getRegistry();
return $registry['DefaultProxy'];
}
-
+
/**
* Accessor for default proxy username.
* @return string Proxy username for authentication.
@@ -160,7 +160,7 @@
$registry =SimpleTestOptions::_getRegistry();
return $registry['DefaultProxyUsername'];
}
-
+
/**
* Accessor for default proxy password.
* @return string Proxy password for authentication.
@@ -170,28 +170,28 @@
$registry =SimpleTestOptions::_getRegistry();
return $registry['DefaultProxyPassword'];
}
-
+
/**
* Accessor for global registry of options.
* @return hash All stored values.
* @access private
* @static
*/
- function _getRegistry() {
+ static function _getRegistry() {
static $registry = false;
if (! $registry) {
$registry = SimpleTestOptions::_getDefaults();
}
return $registry;
}
-
+
/**
* Constant default values.
* @return hash All registry defaults.
* @access private
* @static
*/
- function _getDefaults() {
+ static function _getDefaults() {
return array(
'StubBaseClass' => 'SimpleStub',
'MockBaseClass' => 'SimpleMock',
@@ -202,14 +202,14 @@
'DefaultProxyPassword' => false);
}
}
-
+
/**
* Static methods for compatibility between different
* PHP versions.
* @package SimpleTest
*/
class SimpleTestCompatibility {
-
+
/**
* Identity test. Drops back to equality + types for PHP5
* objects as the === operator counts as the
@@ -219,7 +219,7 @@
* @access public
* @static
*/
- function isIdentical($first, $second) {
+ static function isIdentical($first, $second) {
if ($first != $second) {
return false;
}
@@ -228,7 +228,7 @@
}
return ($first === $second);
}
-
+
/**
* Recursive type test.
* @param mixed $first Test subject.
@@ -236,7 +236,7 @@
* @access private
* @static
*/
- function _isIdenticalType($first, $second) {
+ static function _isIdenticalType($first, $second) {
if (gettype($first) != gettype($second)) {
return false;
}
@@ -253,7 +253,7 @@
}
return true;
}
-
+
/**
* Recursive type test for each element of an array.
* @param mixed $first Test subject.
@@ -261,7 +261,7 @@
* @access private
* @static
*/
- function _isArrayOfIdenticalTypes($first, $second) {
+ static function _isArrayOfIdenticalTypes($first, $second) {
if (array_keys($first) != array_keys($second)) {
return false;
}
@@ -275,7 +275,7 @@
}
return true;
}
-
+
/**
* Test for two variables being aliases.
* @param mixed $first Test subject.
@@ -283,7 +283,7 @@
* @access public
* @static
*/
- function isReference($first, $second) {
+ static function isReference($first, $second) {
if (version_compare(phpversion(), '5', '>=')
&& is_object($first)) {
return ($first === $second);
@@ -294,7 +294,7 @@
$first = $temp;
return $is_ref;
}
-
+
/**
* Test to see if an object is a member of a
* class hiearchy.
@@ -303,7 +303,7 @@
* @access public
* @static
*/
- function isA($object, $class) {
+ static function isA($object, $class) {
if (version_compare(phpversion(), '5') >= 0) {
if (! class_exists($class, false)) {
return false;
@@ -317,7 +317,7 @@
return ((strtolower($class) == get_class($object))
or (is_subclass_of($object, $class)));
}
-
+
/**
* Autoload safe version of class_exists().
* @param string $class Name of class to look for.
@@ -325,14 +325,14 @@
* @access public
* @static
*/
- function classExists($class) {
+ static function classExists($class) {
if (version_compare(phpversion(), '5') >= 0) {
return class_exists($class, false);
} else {
return class_exists($class);
}
}
-
+
/**
* Sets a socket timeout for each chunk.
* @param resource $handle Socket handle.
@@ -340,7 +340,7 @@
* @access public
* @static
*/
- function setTimeout($handle, $timeout) {
+ static function setTimeout($handle, $timeout) {
if (function_exists('stream_set_timeout')) {
stream_set_timeout($handle, $timeout, 0);
} elseif (function_exists('socket_set_timeout')) {
@@ -349,14 +349,14 @@
set_socket_timeout($handle, $timeout, 0);
}
}
-
+
/**
* Gets the current stack trace topmost first.
* @return array List of stack frames.
* @access public
* @static
*/
- function getStackTrace() {
+ static function getStackTrace() {
if (function_exists('debug_backtrace')) {
return array_reverse(debug_backtrace());
}