Changeset 276
- Timestamp:
- 10/07/06 00:48:25 (2 years ago)
- Files:
-
- trunk/build/manifests/testapp.mn (modified) (1 diff)
- trunk/lib/simpletest/authentication.php (modified) (17 diffs)
- trunk/lib/simpletest/encoding.php (modified) (44 diffs)
- trunk/lib/simpletest/errors.php (modified) (4 diffs)
- trunk/lib/simpletest/expectation.php (modified) (56 diffs)
- trunk/lib/simpletest/invoker.php (modified) (2 diffs)
- trunk/lib/simpletest/parser.php (modified) (49 diffs)
- trunk/lib/simpletest/reflection_php5.php (modified) (3 diffs)
- trunk/lib/simpletest/reporter.php (modified) (2 diffs)
- trunk/lib/simpletest/scorer.php (modified) (4 diffs)
- trunk/lib/simpletest/selector.php (modified) (4 diffs)
- trunk/lib/simpletest/shell_tester.php (modified) (4 diffs)
- trunk/lib/simpletest/tag.php (modified) (117 diffs)
- trunk/lib/simpletest/test_case.php (modified) (7 diffs)
- trunk/lib/simpletest/unit_tester.php (modified) (6 diffs)
- trunk/testapp/modules/unittest/classes/junittestcase.class.php (modified) (2 diffs)
- trunk/testapp/modules/unittest/classes/unittestservice.class.php (modified) (1 diff)
- trunk/testapp/modules/unittest/classes/utdao.class.php (modified) (7 diffs)
- trunk/testapp/modules/unittest/classes/utdao2.class.php (modified) (5 diffs)
- trunk/testapp/modules/unittest/classes/utdao_conditions.class.php (added)
- trunk/testapp/modules/unittest/controllers/dao.classic.php (modified) (1 diff)
- trunk/testapp/modules/unittest/templates/menu.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/testapp.mn
r256 r276 63 63 utdao.class.php 64 64 utdao2.class.php 65 utdao_conditions.class.php 65 66 cd testapp/modules/unittest/locales/fr_FR 66 67 testunit.ISO-8859-1.properties trunk/lib/simpletest/authentication.php
r275 r276 10 10 */ 11 11 require_once(dirname(__FILE__) . '/http.php'); 12 12 13 13 /** 14 14 * Represents a single security realm's identity. … … 17 17 */ 18 18 class SimpleRealm { 19 var$_type;20 var$_root;21 var$_username;22 var$_password;23 19 protected $_type; 20 protected $_root; 21 protected $_username; 22 protected $_password; 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. … … 130 130 */ 131 131 class SimpleAuthenticator { 132 var$_realms;133 132 protected $_realms; 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 trunk/lib/simpletest/encoding.php
r275 r276 6 6 * @version $Id: encoding.php,v 1.17 2005/07/20 13:41:40 lastcraft Exp $ 7 7 */ 8 8 9 9 /**#@+ 10 10 * include other SimpleTest class files … … 19 19 */ 20 20 class SimpleEncodedPair { 21 var$_key;22 var$_value;23 21 protected $_key; 22 protected $_value; 23 24 24 /** 25 25 * Stashes the data for rendering later. … … 31 31 $this->_value = $value; 32 32 } 33 33 34 34 /** 35 35 * The pair as a single string. … … 40 40 return $this->_key . '=' . urlencode($this->_value); 41 41 } 42 42 43 43 /** 44 44 * The MIME part as a string. … … 52 52 return $part; 53 53 } 54 54 55 55 /** 56 56 * Is this the value we are looking for? … … 62 62 return $key == $this->_key; 63 63 } 64 64 65 65 /** 66 66 * Is this the value we are looking for? … … 71 71 return $this->_key; 72 72 } 73 73 74 74 /** 75 75 * Is this the value we are looking for? … … 91 91 var $_content; 92 92 var $_filename; 93 93 94 94 /** 95 95 * Stashes the data for rendering later. … … 103 103 $this->_filename = $filename; 104 104 } 105 105 106 106 /** 107 107 * The pair as a single string. … … 112 112 return ''; 113 113 } 114 114 115 115 /** 116 116 * The MIME part as a string. … … 126 126 return $part; 127 127 } 128 128 129 129 /** 130 130 * Attempts to figure out the MIME type from the … … 139 139 return 'application/octet-stream'; 140 140 } 141 141 142 142 /** 143 143 * Tests each character is in the range 0-127. … … 153 153 return true; 154 154 } 155 155 156 156 /** 157 157 * Is this the value we are looking for? … … 163 163 return $key == $this->_key; 164 164 } 165 165 166 166 /** 167 167 * Is this the value we are looking for? … … 172 172 return $this->_key; 173 173 } 174 174 175 175 /** 176 176 * Is this the value we are looking for? … … 191 191 class SimpleEncoding { 192 192 var $_request; 193 193 194 194 /** 195 195 * Starts empty. … … 206 206 $this->merge($query); 207 207 } 208 208 209 209 /** 210 210 * Empties the request of parameters. … … 214 214 $this->_request = array(); 215 215 } 216 216 217 217 /** 218 218 * Adds a parameter to the query. … … 233 233 } 234 234 } 235 235 236 236 /** 237 237 * Adds a new value into the request. … … 243 243 $this->_request[] = new SimpleEncodedPair($key, $value); 244 244 } 245 245 246 246 /** 247 247 * Adds a MIME part to the query. Does nothing for a … … 255 255 $this->_request[] = new SimpleAttachment($key, $content, $filename); 256 256 } 257 257 258 258 /** 259 259 * Adds a set of parameters to this query. … … 271 271 } 272 272 } 273 273 274 274 /** 275 275 * Accessor for single value. … … 294 294 } 295 295 } 296 296 297 297 /** 298 298 * Accessor for listing of pairs. … … 303 303 return $this->_request; 304 304 } 305 305 306 306 /** 307 307 * Renders the query string as a URL encoded … … 320 320 } 321 321 } 322 322 323 323 /** 324 324 * Bundle of GET parameters. Can include … … 328 328 */ 329 329 class SimpleGetEncoding extends SimpleEncoding { 330 330 331 331 /** 332 332 * Starts empty. … … 339 339 $this->SimpleEncoding($query); 340 340 } 341 341 342 342 /** 343 343 * HTTP request method. … … 348 348 return 'GET'; 349 349 } 350 350 351 351 /** 352 352 * Writes no extra headers. … … 356 356 function writeHeadersTo(&$socket) { 357 357 } 358 358 359 359 /** 360 360 * No data is sent to the socket as the data is encoded into … … 365 365 function writeTo(&$socket) { 366 366 } 367 367 368 368 /** 369 369 * Renders the query string as a URL encoded … … 376 376 } 377 377 } 378 378 379 379 /** 380 380 * Bundle of URL parameters for a HEAD request. … … 383 383 */ 384 384 class SimpleHeadEncoding extends SimpleGetEncoding { 385 385 386 386 /** 387 387 * Starts empty. … … 394 394 $this->SimpleGetEncoding($query); 395 395 } 396 396 397 397 /** 398 398 * HTTP request method. … … 404 404 } 405 405 } 406 406 407 407 /** 408 408 * Bundle of POST parameters. Can include … … 412 412 */ 413 413 class SimplePostEncoding extends SimpleEncoding { 414 414 415 415 /** 416 416 * Starts empty. … … 423 423 $this->SimpleEncoding($query); 424 424 } 425 425 426 426 /** 427 427 * HTTP request method. … … 432 432 return 'POST'; 433 433 } 434 434 435 435 /** 436 436 * Dispatches the form headers down the socket. … … 442 442 $socket->write("Content-Type: application/x-www-form-urlencoded\r\n"); 443 443 } 444 444 445 445 /** 446 446 * Dispatches the form data down the socket. … … 451 451 $socket->write($this->_encode()); 452 452 } 453 453 454 454 /** 455 455 * Renders the query string as a URL encoded … … 462 462 } 463 463 } 464 464 465 465 /** 466 466 * Bundle of POST parameters in the multipart … … 471 471 class SimpleMultipartEncoding extends SimplePostEncoding { 472 472 var $_boundary; 473 473 474 474 /** 475 475 * Starts empty. … … 483 483 $this->_boundary = ($boundary === false ? uniqid('st') : $boundary); 484 484 } 485 485 486 486 /** 487 487 * Dispatches the form headers down the socket. … … 493 493 $socket->write("Content-Type: multipart/form-data, boundary=" . $this->_boundary . "\r\n"); 494 494 } 495 495 496 496 /** 497 497 * Dispatches the form data down the socket. … … 502 502 $socket->write($this->_encode()); 503 503 } 504 504 505 505 /** 506 506 * Renders the query string as a URL encoded trunk/lib/simpletest/errors.php
r275 r276 59 59 */ 60 60 class SimpleErrorQueue { 61 var$_queue;61 protected $_queue; 62 62 63 63 /** … … 122 122 * @static 123 123 */ 124 function &instance() {124 static function &instance() { 125 125 static $queue = false; 126 126 if (! $queue) { … … 138 138 * @static 139 139 */ 140 function getSeverityAsString($severity) {140 static function getSeverityAsString($severity) { 141 141 static $map = array( 142 142 E_STRICT => 'E_STRICT', … … 175 175 error_log("$label: $message in $filename on line $line"); 176 176 } 177 $queue = &SimpleErrorQueue::instance();177 $queue = SimpleErrorQueue::instance(); 178 178 $queue->add($severity, $message, $filename, $line, $super_globals); 179 179 set_error_handler('simpleTestErrorHandler'); trunk/lib/simpletest/expectation.php
r275 r276 6 6 * @version $Id: expectation.php,v 1.43 2006/02/05 02:04:24 lastcraft Exp $ 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. … … 22 22 */ 23 23 class SimpleExpectation { 24 var$_dumper;25 var$_message;26 24 protected $_dumper; 25 protected $_message; 26 27 27 /** 28 28 * Creates a dumper for displaying values and sets … … 31 31 */ 32 32 function SimpleExpectation($message = '%s') { 33 $this->_dumper = &new SimpleDumper();33 $this->_dumper = new SimpleDumper(); 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. … … 92 92 } 93 93 } 94 94 95 95 /** 96 96 * Test for equality. … … 99 99 */ 100 100 class EqualExpectation extends SimpleExpectation { 101 var$_value;102 101 protected $_value; 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 } 197 197 } 198 198 199 199 /** 200 200 * Test for being within a range. … … 203 203 */ 204 204 class WithinMarginExpectation extends SimpleExpectation { 205 var$_upper;206 var$_lower;207 205 protected $_upper; 206 protected $_lower; 207 208 208 /** 209 209 * Sets the value to compare against and the fuzziness of … … 219 219 $this->_lower = $value - $margin; 220 220 } 221 221 222 222 /** 223 223 * Tests the expectation. True if it matches the … … 230 230 return (($compare <= $this->_upper) && ($compare >= $this->_lower)); 231 231 } 232 232 233 233 /** 234 234 * Returns a human readable test message. … … 245 245 } 246 246 } 247 247 248 248 /** 249 249 * Creates a the message for being within the range. … … 255 255 $this->_dumper->describeValue($this->_upper) . "]"; 256 256 } 257 257 258 258 /** 259 259 * Creates a the message for being within the range. … … 271 271 } 272 272 } 273 273 274 274 /** 275 275 * Test for being outside of a range. … … 278 278 */ 279 279 class OutsideMarginExpectation extends WithinMarginExpectation { 280 280 281 281 /** 282 282 * Sets the value to compare against and the fuzziness of … … 290 290 $this->WithinMarginExpectation($value, $margin, $message); 291 291 } 292 292 293 293 /** 294 294 * Tests the expectation. True if it matches the … … 301 301 return ! parent::test($compare); 302 302 } 303 303 304 304 /** 305 305 * Returns a human readable test message. … … 317 317 } 318 318 } 319 319 320 320 /** 321 321 * Test for identity. … … 324 324 */ 325 325 class IdenticalExpectation extends EqualExpectation { 326 326 327 327 /** 328 328 * Sets the value to compare against. … … 334 334 $this->EqualExpectation($value, $message); 335 335 } 336 336 337 337 /** 338 338 * Tests the expectation. True if it exactly … … 345 345 return SimpleTestCompatibility::isIdentical($this->_getValue(), $compare); 346 346 } 347 347 348 348 /** 349 349 * Returns a human readable test message. … … 365 365 } 366 366 } 367 367 368 368 /** 369 369 * Test for non-identity. … … 372 372 */ 373 373 class NotIdenticalExpectation extends IdenticalExpectation { 374 374 375 375 /** 376 376 * Sets the value to compare against. … … 382 382 $this->IdenticalExpectation($value, $message); 383 383 } 384 384 385 385 /** 386 386 * Tests the expectation. True if it differs from the … … 393 393 return ! parent::test($compare); 394 394 } 395 395 396 396 /** 397 397 * Returns a human readable test message. … … 411 411 } 412 412 } 413 413 414 414 /** 415 415 * Test for a pattern using Perl regex rules. … … 418 418 */ 419 419 class PatternExpectation extends SimpleExpectation { 420 var$_pattern;421 420 protected $_pattern; 421 422 422 /** 423 423 * Sets the value to compare against. … … 430 430 $this->_pattern = $pattern; 431 431 } 432 432 433 433 /** 434 434 * Accessor for the pattern. … … 439 439 return $this->_pattern; 440 440 } 441 441 442 442 /** 443 443 * Tests the expectation. True if the Perl regex … … 450 450 return (boolean)preg_match($this->_getPattern(), $compare); 451 451 } 452 452 453 453 /** 454 454 * Returns a human readable test message. … … 468 468 } 469 469 } 470 470 471 471 /** 472 472 * Describes a pattern match including the string … … 488 488 } 489 489 } 490 490 491 491 /** 492 492 * @deprecated … … 494 494 class WantedPatternExpectation extends PatternExpectation { 495 495 } 496 496 497 497 /** 498 498 * Fail if a pattern is detected within the … … 502 502 */ 503 503 class NoPatternExpectation extends PatternExpectation { 504 504 505 505 /** 506 506 * Sets the reject pattern … … 512 512 $this->PatternExpectation($pattern, $message); 513 513 } 514 514 515 515 /** 516 516 * Tests the expectation. False if the Perl regex … … 523 523 return ! parent::test($compare); 524 524 } 525 525 526 526 /** 527 527 * Returns a human readable test message. … … 542 542 } 543 543 } 544 544 545 545 /** 546 546 * @package SimpleTest … … 550 550 class UnwantedPatternExpectation extends NoPatternExpectation { 551 551 } 552 552 553 553 /** 554 554 * Tests either type or class name if it's an object. … … 557 557 */ 558 558 class IsAExpectation extends SimpleExpectation { 559 var$_type;560 559 protected $_type; 560 561 561 /** 562 562 * Sets the type to compare with. … … 569 569 $this->_type = $type; 570 570 } 571 571 572 572 /** 573 573 * Accessor for type to check against. … … 578 578 return $this->_type; 579 579 } 580 580 581 581 /** 582 582 * Tests the expectation. True if the type or … … 626 626 } 627 627 } 628 628 629 629 /** 630 630 * Tests either type or class name if it's an object. … … 634 634 */ 635 635 class NotAExpectation extends IsAExpectation { 636 var$_type;637 636 protected $_type; 637 638 638 /** 639 639 * Sets the type to compare with. … … 645 645 $this->IsAExpectation($type, $message); 646 646 } 647 647 648 648 /** 649 649 * Tests the expectation. False if the type or … … 677 677 */ 678 678 class MethodExistsExpectation extends SimpleExpectation { 679 var$_method;680 679 protected $_method; 680 681 681 /** 682 682 * Sets the value to compare against. … … 690 690 $this->_method = &$method; 691 691 } 692 692 693 693 /** 694 694 * Tests the expectation. True if the method exists in the test object. … … 700 700 return (boolean)(is_object($compare) && method_exists($compare, $this->_method)); 701 701 } 702 702 703 703 /** 704 704 * Returns a human readable test message. trunk/lib/simpletest/invoker.php
r275 r276 29 29 */ 30 30 class SimpleInvoker { 31 var$_test_case;31 protected $_test_case; 32 32 33 33 /** … … 88 88 */ 89 89 class SimpleInvokerDecorator { 90 var$_invoker;90 protected $_invoker; 91 91 92 92 /** trunk/lib/simpletest/parser.php
r275 r276 26 26 } 27 27 /**#@-*/ 28 28 29 29 /** 30 30 * Compounded regular expression. Any of … … 35 35 */ 36 36 class ParallelRegex { 37 var$_patterns;38 var$_labels;39 var$_regex;40 var$_case;41 37 protected $_patterns; 38 protected $_labels; 39 protected $_regex; 40 protected $_case; 41 42 42 /** 43 43 * Constructor. Starts with no patterns. … … 52 52 $this->_regex = null; 53 53 } 54 54 55 55 /** 56 56 * Adds a pattern with an optional label. … … 67 67 $this->_regex = null; 68 68 } 69 69 70 70 /** 71 71 * Attempts to match all patterns at once against … … 93 93 return true; 94 94 } 95 95 96 96 /** 97 97 * Compounds the patterns into a single … … 114 114 return $this->_regex; 115 115 }
