Changeset 1526 for branches/3.0
- Timestamp:
- 11/28/2006 05:34:00 PM (2 years ago)
- Location:
- branches/3.0/tests
- Files:
-
- 2 added
- 14 modified
-
FunctionalTests/tickets/protected/pages/Ticket463.page (added)
-
FunctionalTests/tickets/tests/Ticket463TestCase.php (added)
-
test_tools/simpletest/authentication.php (modified) (18 diffs)
-
test_tools/simpletest/compatibility.php (modified) (17 diffs)
-
test_tools/simpletest/dumper.php (modified) (20 diffs)
-
test_tools/simpletest/expectation.php (modified) (56 diffs)
-
test_tools/simpletest/mock_objects.php (modified) (3 diffs)
-
test_tools/simpletest/options.php (modified) (36 diffs)
-
test_tools/simpletest/parser.php (modified) (51 diffs)
-
test_tools/simpletest/reporter.php (modified) (1 diff)
-
test_tools/simpletest/scorer.php (modified) (1 diff)
-
test_tools/simpletest/simple_test.php (modified) (1 diff)
-
test_tools/simpletest/simpletest.php (modified) (11 diffs)
-
test_tools/simpletest/test_case.php (modified) (1 diff)
-
test_tools/simpletest/url.php (modified) (35 diffs)
-
test_tools/unit_tests.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/tests/test_tools/simpletest/authentication.php
r1397 r1526 10 10 */ 11 11 require_once(dirname(__FILE__) . '/http.php'); 12 12 13 13 /** 14 14 * Represents a single security realm's identity. … … 21 21 protected $_username; 22 22 protected $_password; 23 23 24 24 /** 25 25 * Starts with the initial entry directory. … … 36 36 $this->_password = false; 37 37 } 38 38 39 39 /** 40 40 * Adds another location to the realm. … … 45 45 $this->_root = $this->_getCommonPath($this->_root, $url->getPath()); 46 46 } 47 47 48 48 /** 49 49 * Finds the common starting path. … … 63 63 return implode('/', $first) . '/'; 64 64 } 65 65 66 66 /** 67 67 * Sets the identity to try within this realm. … … 74 74 $this->_password = $password; 75 75 } 76 76 77 77 /** 78 78 * Accessor for current identity. … … 83 83 return $this->_username; 84 84 } 85 85 86 86 /** 87 87 * Accessor for current identity. … … 92 92 return $this->_password; 93 93 } 94 94 95 95 /** 96 96 * Test to see if the URL is within the directory … … 109 109 return false; 110 110 } 111 111 112 112 /** 113 113 * Tests to see if one string is a substring of … … 123 123 } 124 124 } 125 125 126 126 /** 127 127 * Manages security realms. … … 131 131 class SimpleAuthenticator { 132 132 protected $_realms; 133 133 134 134 /** 135 135 * Clears the realms. … … 139 139 $this->restartSession(); 140 140 } 141 141 142 142 /** 143 143 * Starts with no realms set up. … … 147 147 $this->_realms = array(); 148 148 } 149 149 150 150 /** 151 151 * Adds a new realm centered the current URL. … … 167 167 $this->_realms[$url->getHost()][$realm] = new SimpleRealm($type, $url); 168 168 } 169 169 170 170 /** 171 171 * Sets the current identity to be presented … … 182 182 } 183 183 } 184 184 185 185 /** 186 186 * Finds the name of the realm by comparing URLs. … … 200 200 return false; 201 201 } 202 202 203 203 /** 204 204 * Presents the appropriate headers for this location. … … 219 219 $this->addBasicHeaders($request, $username, $password); 220 220 } 221 221 222 222 /** 223 223 * Presents the appropriate headers for this … … 229 229 * @static 230 230 */ 231 function addBasicHeaders($request, $username, $password) {231 static function addBasicHeaders($request, $username, $password) { 232 232 if ($username && $password) { 233 233 $request->addHeaderLine( -
branches/3.0/tests/test_tools/simpletest/compatibility.php
r1397 r1526 5 5 * @version $Id$ 6 6 */ 7 7 8 8 /** 9 9 * Static methods for compatibility between different … … 12 12 */ 13 13 class SimpleTestCompatibility { 14 14 15 15 /** 16 16 * Creates a copy whether in PHP5 or PHP4. … … 20 20 * @static 21 21 */ 22 function copy($object) {22 static function copy($object) { 23 23 if (version_compare(phpversion(), '5') >= 0) { 24 24 eval('$copy = clone $object;'); … … 27 27 return $object; 28 28 } 29 29 30 30 /** 31 31 * Identity test. Drops back to equality + types for PHP5 … … 38 38 * @static 39 39 */ 40 function isIdentical($first, $second) {40 static function isIdentical($first, $second) { 41 41 if ($first != $second) { 42 42 return false; … … 47 47 return ($first === $second); 48 48 } 49 49 50 50 /** 51 51 * Recursive type test. … … 56 56 * @static 57 57 */ 58 function _isIdenticalType($first, $second) {58 static function _isIdenticalType($first, $second) { 59 59 if (gettype($first) != gettype($second)) { 60 60 return false; … … 73 73 return true; 74 74 } 75 75 76 76 /** 77 77 * Recursive type test for each element of an array. … … 82 82 * @static 83 83 */ 84 function _isArrayOfIdenticalTypes($first, $second) {84 static function _isArrayOfIdenticalTypes($first, $second) { 85 85 if (array_keys($first) != array_keys($second)) { 86 86 return false; … … 96 96 return true; 97 97 } 98 98 99 99 /** 100 100 * Test for two variables being aliases. … … 105 105 * @static 106 106 */ 107 function isReference($first, $second) {107 static function isReference($first, $second) { 108 108 if (version_compare(phpversion(), '5', '>=') 109 109 && is_object($first)) { … … 123 123 return $is_ref; 124 124 } 125 125 126 126 /** 127 127 * Test to see if an object is a member of a … … 133 133 * @static 134 134 */ 135 function isA($object, $class) {135 static function isA($object, $class) { 136 136 if (version_compare(phpversion(), '5') >= 0) { 137 137 if (! class_exists($class, false)) { … … 151 151 or (is_subclass_of($object, $class))); 152 152 } 153 153 154 154 /** 155 155 * Sets a socket timeout for each chunk. … … 159 159 * @static 160 160 */ 161 function setTimeout($handle, $timeout) {161 static function setTimeout($handle, $timeout) { 162 162 if (function_exists('stream_set_timeout')) { 163 163 stream_set_timeout($handle, $timeout, 0); … … 168 168 } 169 169 } 170 170 171 171 /** 172 172 * Gets the current stack trace topmost first. … … 175 175 * @static 176 176 */ 177 function getStackTrace() {177 static function getStackTrace() { 178 178 if (function_exists('debug_backtrace')) { 179 179 return array_reverse(debug_backtrace()); -
branches/3.0/tests/test_tools/simpletest/dumper.php
r1397 r1526 12 12 define('TYPE_MATTERS', true); 13 13 } 14 14 15 15 /** 16 16 * Displays variables as text and does diffs. … … 19 19 */ 20 20 class SimpleDumper { 21 21 22 22 /** 23 23 * Renders a variable in a shorter form than print_r(). … … 44 44 return "Unknown"; 45 45 } 46 46 47 47 /** 48 48 * Gets the string representation of a type. … … 96 96 return $this->$method($first, $second, $identical); 97 97 } 98 98 99 99 /** 100 100 * Tests to see if types match. … … 129 129 return ($start > 0 ? "..." : "") . $value . ($start + $size < $length ? "..." : ""); 130 130 } 131 131 132 132 /** 133 133 * Creates a human readable description of the … … 144 144 $this->describeValue($second) . "]"; 145 145 } 146 146 147 147 /** 148 148 * Creates a human readable description of the … … 157 157 return $this->_describeGenericDifference($first, $second); 158 158 } 159 159 160 160 /** 161 161 * Creates a human readable description of the … … 170 170 return $this->_describeGenericDifference($first, $second); 171 171 } 172 172 173 173 /** 174 174 * Creates a human readable description of the … … 191 191 return $message; 192 192 } 193 193 194 194 /** 195 195 * Creates a human readable description of the … … 210 210 abs($first - $second); 211 211 } 212 212 213 213 /** 214 214 * Creates a human readable description of the … … 229 229 abs($first - $second); 230 230 } 231 231 232 232 /** 233 233 * Creates a human readable description of the … … 262 262 return ""; 263 263 } 264 264 265 265 /** 266 266 * Compares two arrays to see if their key lists match. … … 283 283 return ($first_keys == $second_keys); 284 284 } 285 285 286 286 /** 287 287 * Creates a human readable description of the … … 296 296 return $this->_describeGenericDifference($first, $second); 297 297 } 298 298 299 299 /** 300 300 * Creates a human readable description of the … … 315 315 $identical); 316 316 } 317 317 318 318 /** 319 319 * Find the first character position that differs … … 342 342 return $position; 343 343 } 344 344 345 345 /** 346 346 * Sends a formatted dump of a variable to a string. … … 350 350 * @static 351 351 */ 352 function dump($variable) {352 static function dump($variable) { 353 353 ob_start(); 354 354 print_r($variable); … … 365 365 * @static 366 366 */ 367 function getFormattedAssertionLine($stack) {367 static function getFormattedAssertionLine($stack) { 368 368 foreach ($stack as $frame) { 369 369 if (isset($frame['file'])) { … … 380 380 return ''; 381 381 } 382 382 383 383 /** 384 384 * Tries to determine if the method call is an assertion. … … 387 387 * @static 388 388 */ 389 function _stackFrameIsAnAssertion($frame) {389 static function _stackFrameIsAnAssertion($frame) { 390 390 if (($frame['function'] == 'fail') || ($frame['function'] == 'pass')) { 391 391 return true; -
branches/3.0/tests/test_tools/simpletest/expectation.php
r1397 r1526 6 6 * @version $Id$ 7 7 */ 8 8 9 9 /**#@+ 10 10 * include other SimpleTest class files … … 13 13 require_once(dirname(__FILE__) . '/compatibility.php'); 14 14 /**#@-*/ 15 15 16 16 /** 17 17 * Assertion that can display failure information. … … 24 24 protected $_dumper; 25 25 protected $_message; 26 26 27 27 /** 28 28 * Creates a dumper for displaying values and sets … … 34 34 $this->_message = $message; 35 35 } 36 36 37 37 /** 38 38 * Tests the expectation. True if correct. … … 44 44 function test($compare) { 45 45 } 46 46 47 47 /** 48 48 * Returns a human readable test message. … … 55 55 function testMessage($compare) { 56 56 } 57 57 58 58 /** 59 59 * Overlays the generated message onto the stored user … … 67 67 return sprintf($this->_message, $this->testMessage($compare)); 68 68 } 69 69 70 70 /** 71 71 * Accessor for the dumper. … … 76 76 return $this->_dumper; 77 77 } 78 78 79 79 /** 80 80 * Test to see if a value is an expectation object. … … 87 87 * @static 88 88 */ 89 function isExpectation($expectation) {89 static function isExpectation($expectation) { 90 90 return is_object($expectation) && 91 91 SimpleTestCompatibility::isA($expectation, 'SimpleExpectation'); 92 92 } 93 93 } 94 94 95 95 /** 96 96 * Test for equality. … … 100 100 class EqualExpectation extends SimpleExpectation { 101 101 protected $_value; 102 102 103 103 /** 104 104 * Sets the value to compare against. … … 111 111 $this->_value = $value; 112 112 } 113 113 114 114 /** 115 115 * Tests the expectation. True if it matches the … … 122 122 return (($this->_value == $compare) && ($compare == $this->_value)); 123 123 } 124 124 125 125 /** 126 126 * Returns a human readable test message. … … 148 148 } 149 149 } 150 150 151 151 /** 152 152 * Test for inequality. … … 155 155 */ 156 156 class NotEqualExpectation extends EqualExpectation { 157 157 158 158 /** 159 159 * Sets the value to compare against. … … 165 165 $this->EqualExpectation($value, $message); 166 166 } 167 167 168 168 /** 169 169 * Tests the expectation. True if it differs from the … … 176 176 return ! parent::test($compare); 177 177 } 178 178 179 179 /** 180 180 * Returns a human readable test message. … … 196 196
