Changeset 275
- Timestamp:
- 10/06/06 22:29:35 (2 years ago)
- Files:
-
- trunk/build/manifests/jelix-dev.mn (modified) (1 diff)
- trunk/lib/jelix-scripts/CREDITS (modified) (1 diff)
- trunk/lib/simpletest/authentication.php (modified) (2 diffs)
- trunk/lib/simpletest/browser.php (modified) (32 diffs)
- trunk/lib/simpletest/collector.php (added)
- trunk/lib/simpletest/compatibility.php (added)
- trunk/lib/simpletest/cookies.php (added)
- trunk/lib/simpletest/detached.php (added)
- trunk/lib/simpletest/docs (deleted)
- trunk/lib/simpletest/dumper.php (modified) (6 diffs)
- trunk/lib/simpletest/encoding.php (modified) (5 diffs)
- trunk/lib/simpletest/errors.php (modified) (4 diffs)
- trunk/lib/simpletest/exceptions.php (added)
- trunk/lib/simpletest/expectation.php (modified) (33 diffs)
- trunk/lib/simpletest/form.php (modified) (27 diffs)
- trunk/lib/simpletest/frames.php (modified) (8 diffs)
- trunk/lib/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE (modified) (2 diffs)
- trunk/lib/simpletest/http.php (modified) (39 diffs)
- trunk/lib/simpletest/invoker.php (added)
- trunk/lib/simpletest/LICENSE (modified) (1 diff)
- trunk/lib/simpletest/mock_objects.php (modified) (35 diffs)
- trunk/lib/simpletest/options.php (deleted)
- trunk/lib/simpletest/page.php (modified) (24 diffs)
- trunk/lib/simpletest/parser.php (modified) (40 diffs)
- trunk/lib/simpletest/README (modified) (4 diffs)
- trunk/lib/simpletest/README_JELIX (deleted)
- trunk/lib/simpletest/reflection_php4.php (added)
- trunk/lib/simpletest/reflection_php5.php (added)
- trunk/lib/simpletest/remote.php (modified) (6 diffs)
- trunk/lib/simpletest/reporter.php (modified) (7 diffs)
- trunk/lib/simpletest/runner.php (deleted)
- trunk/lib/simpletest/scorer.php (modified) (11 diffs)
- trunk/lib/simpletest/selector.php (added)
- trunk/lib/simpletest/shell_tester.php (modified) (11 diffs)
- trunk/lib/simpletest/simpletest.php (added)
- trunk/lib/simpletest/simple_test.php (deleted)
- trunk/lib/simpletest/socket.php (modified) (7 diffs)
- trunk/lib/simpletest/tag.php (modified) (62 diffs)
- trunk/lib/simpletest/test/acceptance_test.php (modified) (30 diffs)
- trunk/lib/simpletest/test/adapter_test.php (modified) (3 diffs)
- trunk/lib/simpletest/test/all_tests.php (modified) (1 diff)
- trunk/lib/simpletest/test/authentication_test.php (modified) (14 diffs)
- trunk/lib/simpletest/test/browser_test.php (modified) (29 diffs)
- trunk/lib/simpletest/test/collector_test.php (added)
- trunk/lib/simpletest/test/compatibility_test.php (added)
- trunk/lib/simpletest/test/cookies_test.php (added)
- trunk/lib/simpletest/test/detached_test.php (added)
- trunk/lib/simpletest/test/dumper_test.php (modified) (2 diffs)
- trunk/lib/simpletest/test/encoding_test.php (modified) (1 diff)
- trunk/lib/simpletest/test/expectation_test.php (modified) (5 diffs)
- trunk/lib/simpletest/test/form_test.php (modified) (7 diffs)
- trunk/lib/simpletest/test/frames_test.php (modified) (27 diffs)
- trunk/lib/simpletest/test/http_test.php (modified) (13 diffs)
- trunk/lib/simpletest/test/interfaces_test.php (added)
- trunk/lib/simpletest/test/live_test.php (modified) (1 diff)
- trunk/lib/simpletest/test/mock_objects_test.php (added)
- trunk/lib/simpletest/test/options_test.php (deleted)
- trunk/lib/simpletest/test/page_test.php (modified) (40 diffs)
- trunk/lib/simpletest/test/parser_test.php (modified) (16 diffs)
- trunk/lib/simpletest/test/parse_error_test.php (modified) (1 diff)
- trunk/lib/simpletest/test/reflection_php4_test.php (added)
- trunk/lib/simpletest/test/reflection_php5_test.php (added)
- trunk/lib/simpletest/test/remote_test.php (modified) (1 diff)
- trunk/lib/simpletest/test/shell_test.php (modified) (2 diffs)
- trunk/lib/simpletest/test/shell_tester_test.php (modified) (1 diff)
- trunk/lib/simpletest/test/simpletest_test.php (added)
- trunk/lib/simpletest/test/simple_mock_test.php (deleted)
- trunk/lib/simpletest/test/support (added)
- trunk/lib/simpletest/test/support/collector (added)
- trunk/lib/simpletest/test/support/collector/collectable.1 (added)
- trunk/lib/simpletest/test/support/collector/collectable.2 (added)
- trunk/lib/simpletest/test/support/latin1_sample (added)
- trunk/lib/simpletest/test/support/spl_examples.php (added)
- trunk/lib/simpletest/test/support/supplementary_upload_sample.txt (added)
- trunk/lib/simpletest/test/support/upload_sample.txt (added)
- trunk/lib/simpletest/test/tag_test.php (modified) (22 diffs)
- trunk/lib/simpletest/test/test_groups.php (added)
- trunk/lib/simpletest/test/unit_tester_test.php (modified) (2 diffs)
- trunk/lib/simpletest/test/unit_tests.php (modified) (1 diff)
- trunk/lib/simpletest/test/url_test.php (modified) (17 diffs)
- trunk/lib/simpletest/test/user_agent_test.php (modified) (10 diffs)
- trunk/lib/simpletest/test/visual_test.php (modified) (20 diffs)
- trunk/lib/simpletest/test/web_tester_test.php (modified) (9 diffs)
- trunk/lib/simpletest/test/xml_test.php (modified) (11 diffs)
- trunk/lib/simpletest/test_case.php (added)
- trunk/lib/simpletest/unit_tester.php (modified) (16 diffs)
- trunk/lib/simpletest/url.php (modified) (38 diffs)
- trunk/lib/simpletest/user_agent.php (modified) (19 diffs)
- trunk/lib/simpletest/VERSION (modified) (1 diff)
- trunk/lib/simpletest/web_tester.php (modified) (82 diffs)
- trunk/lib/simpletest/xml.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/jelix-dev.mn
r271 r275 1 1 cd lib/simpletest 2 authentication.php 3 browser.php 4 collector.php 5 compatibility.php 6 cookies.php 7 detached.php 8 dumper.php 9 encoding.php 2 10 errors.php 3 options.php 4 dumper.php 11 exceptions.php 5 12 expectation.php 6 socket.php7 encoding.php8 url.php9 http.php10 authentication.php11 user_agent.php12 browser.php13 parser.php14 tag.php15 13 form.php 16 14 frames.php 15 HELP_MY_TESTS_DONT_WORK_ANYMORE 16 http.php 17 invoker.php 18 LICENSE 19 mock_objects.php 17 20 page.php 21 parser.php 22 README 23 reflection_php4.php 24 reflection_php5.php 18 25 remote.php 19 r unner.php26 reporter.php 20 27 scorer.php 21 reporter.php 22 mock_objects.php 23 simple_test.php 28 selector.php 29 shell_tester.php 30 simpletest.php 31 socket.php 32 tag.php 33 test_case.php 24 34 unit_tester.php 35 url.php 36 user_agent.php 37 VERSION 25 38 web_tester.php 26 shell_tester.php27 39 xml.php 28 README29 VERSION30 LICENSE31 HELP_MY_TESTS_DONT_WORK_ANYMORE32 README_JELIX33 40 cd lib/simpletest/extensions 34 41 pear_test_case.php 35 42 phpunit_test_case.php 36 43 cd lib/simpletest/test 44 acceptance_test.php 45 adapter_test.php 37 46 all_tests.php 38 unit_tests.php 39 acceptance_test.php 47 authentication_test.php 48 browser_test.php 49 collector_test.php 50 compatibility_test.php 51 cookies_test.php 52 detached_test.php 53 dumper_test.php 54 encoding_test.php 40 55 errors_test.php 41 options_test.php42 dumper_test.php43 56 expectation_test.php 44 adapter_test.php45 socket_test.php46 url_test.php47 encoding_test.php48 http_test.php49 authentication_test.php50 user_agent_test.php51 browser_test.php52 parser_test.php53 tag_test.php54 57 form_test.php 55 58 frames_test.php 59 http_test.php 60 interfaces_test.php 61 live_test.php 62 mock_objects_test.php 56 63 page_test.php 64 parse_error_test.php 65 parser_test.php 66 real_sites_test.php 67 reflection_php4_test.php 68 reflection_php5_test.php 57 69 remote_test.php 58 simple_mock_test.php 70 shell_tester_test.php 71 shell_test.php 72 simpletest_test.php 73 socket_test.php 74 tag_test.php 75 test_groups.php 76 test_with_parse_error.php 77 unit_tester_test.php 78 unit_tests.php 79 url_test.php 80 user_agent_test.php 59 81 visual_test.php 60 shell_test.php61 82 web_tester_test.php 62 unit_tester_test.php63 shell_tester_test.php64 83 xml_test.php 65 live_test.php 66 real_sites_test.php 67 parse_error_test.php 68 test_with_parse_error.php 69 cd lib/simpletest/docs/en 70 docs.css 71 index.html 72 overview.html 73 unit_test_documentation.html 74 group_test_documentation.html 75 server_stubs_documentation.html 76 mock_objects_documentation.html 77 partial_mocks_documentation.html 78 reporter_documentation.html 79 expectation_documentation.html 80 web_tester_documentation.html 81 form_testing_documentation.html 82 authentication_documentation.html 83 browser_documentation.html 84 cd lib/simpletest/docs/fr 85 docs.css 86 index.html 87 overview.html 88 unit_test_documentation.html 89 group_test_documentation.html 90 server_stubs_documentation.html 91 mock_objects_documentation.html 92 partial_mocks_documentation.html 93 reporter_documentation.html 94 expectation_documentation.html 95 web_tester_documentation.html 96 form_testing_documentation.html 97 authentication_documentation.html 98 browser_documentation.html 84 cd lib/simpletest/test/support 85 latin1_sample 86 spl_examples.php 87 supplementary_upload_sample.txt 88 upload_sample.txt 89 cd lib/simpletest/test/support/collector 90 collectable.1 91 collectable.2 99 92 100 93 cd lib/jelix-scripts trunk/lib/jelix-scripts/CREDITS
r1 r275 3 3 4 4 Concepteur et d�loppeur : Laurent Jouanneau 5 6 Contributeurs : 7 Loic Mathaud (bug fix) 8 Thiriot Christophe (clearcache) trunk/lib/simpletest/authentication.php
r67 r275 4 4 * @package SimpleTest 5 5 * @subpackage WebTester 6 * @version $Id: authentication.php,v 1. 9 2004/09/19 17:24:11lastcraft Exp $6 * @version $Id: authentication.php,v 1.10 2005/07/26 01:27:18 lastcraft Exp $ 7 7 */ 8 8 /** … … 101 101 */ 102 102 function isWithin($url) { 103 return (strpos($url->getBasePath(), $this->_root) === 0); 103 if ($this->_isIn($this->_root, $url->getBasePath())) { 104 return true; 105 } 106 if ($this->_isIn($this->_root, $url->getBasePath() . $url->getPage() . '/')) { 107 return true; 108 } 109 return false; 110 } 111 112 /** 113 * Tests to see if one string is a substring of 114 * another. 115 * @param string $part Small bit. 116 * @param string $whole Big bit. 117 * @return boolean True if the small bit is 118 * in the big bit. 119 * @access private 120 */ 121 function _isIn($part, $whole) { 122 return strpos($whole, $part) === 0; 104 123 } 105 124 } trunk/lib/simpletest/browser.php
r67 r275 1 1 <?php 2 2 /** 3 * Base include file for SimpleTest4 * @packageSimpleTest5 * @subpackageWebTester6 * @version $Id: browser.php,v 1.141 2005/02/22 02:39:21lastcraft Exp $3 * Base include file for SimpleTest 4 * @package SimpleTest 5 * @subpackage WebTester 6 * @version $Id: browser.php,v 1.162 2006/02/05 01:07:49 lastcraft Exp $ 7 7 */ 8 8 9 9 /**#@+ 10 * include other SimpleTest class files10 * include other SimpleTest class files 11 11 */ 12 require_once(dirname(__FILE__) . '/ options.php');12 require_once(dirname(__FILE__) . '/simpletest.php'); 13 13 require_once(dirname(__FILE__) . '/http.php'); 14 14 require_once(dirname(__FILE__) . '/encoding.php'); 15 15 require_once(dirname(__FILE__) . '/page.php'); 16 require_once(dirname(__FILE__) . '/selector.php'); 16 17 require_once(dirname(__FILE__) . '/frames.php'); 17 18 require_once(dirname(__FILE__) . '/user_agent.php'); 18 19 /**#@-*/ 19 20 20 define('DEFAULT_MAX_NESTED_FRAMES', 3); 21 if (!defined('DEFAULT_MAX_NESTED_FRAMES')) { 22 define('DEFAULT_MAX_NESTED_FRAMES', 3); 23 } 21 24 22 25 /** 23 26 * Browser history list. 24 * @package SimpleTest25 * @subpackage WebTester27 * @package SimpleTest 28 * @subpackage WebTester 26 29 */ 27 30 class SimpleBrowserHistory { 28 protected$_sequence;29 protected$_position;31 var $_sequence; 32 var $_position; 30 33 31 34 /** … … 67 70 /** 68 71 * Adds a successfully fetched page to the history. 69 * @param string $method GET or POST.70 72 * @param SimpleUrl $url URL of fetch. 71 * @param Simple FormEncoding $parametersAny post data with the fetch.72 * @access public 73 */ 74 function recordEntry($ method, $url, $parameters) {73 * @param SimpleEncoding $parameters Any post data with the fetch. 74 * @access public 75 */ 76 function recordEntry($url, $parameters) { 75 77 $this->_dropFuture(); 76 78 array_push( 77 79 $this->_sequence, 78 array(' method' => $method, 'url' => $url, 'parameters' => $parameters));80 array('url' => $url, 'parameters' => $parameters)); 79 81 $this->_position++; 80 }81 82 /**83 * Last fetching method for current history84 * position.85 * @return string GET or POST for this point in86 * the history.87 * @access public88 */89 function getMethod() {90 if ($this->_isEmpty()) {91 return false;92 }93 return $this->_sequence[$this->_position]['method'];94 82 } 95 83 … … 167 155 * the user agent, the HTML parsing, request history 168 156 * and the last header set. 169 * @package SimpleTest170 * @subpackage WebTester157 * @package SimpleTest 158 * @subpackage WebTester 171 159 */ 172 160 class SimpleBrowser { 173 protected$_user_agent;174 protected$_page;175 protected$_history;176 protected$_ignore_frames;177 protected$_maximum_nested_frames;161 var $_user_agent; 162 var $_page; 163 var $_history; 164 var $_ignore_frames; 165 var $_maximum_nested_frames; 178 166 179 167 /** … … 187 175 $this->_user_agent = &$this->_createUserAgent(); 188 176 $this->_user_agent->useProxy( 189 SimpleTest Options::getDefaultProxy(),190 SimpleTest Options::getDefaultProxyUsername(),191 SimpleTest Options::getDefaultProxyPassword());192 $this->_page = new SimplePage();177 SimpleTest::getDefaultProxy(), 178 SimpleTest::getDefaultProxyUsername(), 179 SimpleTest::getDefaultProxyPassword()); 180 $this->_page = &new SimplePage(); 193 181 $this->_history = &$this->_createHistory(); 194 182 $this->_ignore_frames = false; … … 202 190 */ 203 191 function &_createUserAgent() { 204 return new SimpleUserAgent(); 192 $user_agent = &new SimpleUserAgent(); 193 return $user_agent; 205 194 } 206 195 … … 211 200 */ 212 201 function &_createHistory() { 213 return new SimpleBrowserHistory(); 202 $history = &new SimpleBrowserHistory(); 203 return $history; 214 204 } 215 205 … … 230 220 function useFrames() { 231 221 $this->_ignore_frames = false; 222 } 223 224 /** 225 * Switches off cookie sending and recieving. 226 * @access public 227 */ 228 function ignoreCookies() { 229 $this->_user_agent->ignoreCookies(); 230 } 231 232 /** 233 * Switches back on the cookie sending and recieving. 234 * @access public 235 */ 236 function useCookies() { 237 $this->_user_agent->useCookies(); 232 238 } 233 239 … … 238 244 * @param integer $depth Nested frameset depth. 239 245 * @return SimplePage Parsed HTML. 240 * @access pr otected246 * @access private 241 247 */ 242 248 function &_parse($response, $depth = 0) { 243 $builder = new SimplePageBuilder(); 244 $page = &$builder->parse($response); 249 $page = &$this->_buildPage($response); 245 250 if ($this->_ignore_frames || ! $page->hasFrames() || ($depth > $this->_maximum_nested_frames)) { 246 251 return $page; 247 252 } 248 $frameset = new SimpleFrameset($page);253 $frameset = &new SimpleFrameset($page); 249 254 foreach ($page->getFrameset() as $key => $url) { 250 $frame = &$this->_fetch( 'GET', $url, array(), $depth + 1);255 $frame = &$this->_fetch($url, new SimpleGetEncoding(), $depth + 1); 251 256 $frameset->addFrame($frame, $key); 252 257 } 253 258 return $frameset; 254 259 } 255 256 /** 257 * Fetches a page. 258 * @param string $method GET or POST. 259 * @param string/SimpleUrl $url Target to fetch as string. 260 * @param SimpleFormEncoding $parameters POST parameters. 261 * @param integer $depth Nested frameset depth protection. 262 * @return SimplePage Parsed page. 260 261 /** 262 * Assembles the parsing machinery and actually parses 263 * a single page. Frees all of the builder memory and so 264 * unjams the PHP memory management. 265 * @param SimpleHttpResponse $response Response from fetch. 266 * @return SimplePage Parsed top level page. 267 * @access protected 268 */ 269 function &_buildPage($response) { 270 $builder = &new SimplePageBuilder(); 271 $page = &$builder->parse($response); 272 $builder->free(); 273 unset($builder); 274 return $page; 275 } 276 277 /** 278 * Fetches a page. Jointly recursive with the _parse() 279 * method as it descends a frameset. 280 * @param string/SimpleUrl $url Target to fetch. 281 * @param SimpleEncoding $encoding GET/POST parameters. 282 * @param integer $depth Nested frameset depth protection. 283 * @return SimplePage Parsed page. 263 284 * @access private 264 285 */ 265 function &_fetch($ method, $url, $parameters, $depth = 0) {266 $response = &$this->_user_agent->fetchResponse($ method, $url, $parameters);286 function &_fetch($url, $encoding, $depth = 0) { 287 $response = &$this->_user_agent->fetchResponse($url, $encoding); 267 288 if ($response->isError()) { 268 return new SimplePage($response); 269 } 270 return $this->_parse($response, $depth); 289 $page = &new SimplePage($response); 290 } else { 291 $page = &$this->_parse($response, $depth); 292 } 293 return $page; 271 294 } 272 295 … … 274 297 * Fetches a page or a single frame if that is the current 275 298 * focus. 276 * @param string $method GET or POST. 299 * @param SimpleUrl $url Target to fetch. 300 * @param SimpleEncoding $parameters GET/POST parameters. 301 * @return string Raw content of page. 302 * @access private 303 */ 304 function _load($url, $parameters) { 305 $frame = $url->getTarget(); 306 if (! $frame || ! $this->_page->hasFrames() || (strtolower($frame) == '_top')) { 307 return $this->_loadPage($url, $parameters); 308 } 309 return $this->_loadFrame(array($frame), $url, $parameters); 310 } 311 312 /** 313 * Fetches a page and makes it the current page/frame. 314 * @param string/SimpleUrl $url Target to fetch as string. 315 * @param SimplePostEncoding $parameters POST parameters. 316 * @return string Raw content of page. 317 * @access private 318 */ 319 function _loadPage($url, $parameters) { 320 $this->_page = &$this->_fetch($url, $parameters); 321 $this->_history->recordEntry( 322 $this->_page->getUrl(), 323 $this->_page->getRequestData()); 324 return $this->_page->getRaw(); 325 } 326 327 /** 328 * Fetches a frame into the existing frameset replacing the 329 * original. 330 * @param array $frames List of names to drill down. 277 331 * @param string/SimpleUrl $url Target to fetch as string. 278 332 * @param SimpleFormEncoding $parameters POST parameters. … … 280 334 * @access private 281 335 */ 282 function _load($method, $url, $parameters = false) { 283 $frame = $url->getTarget(); 284 if (! $frame || ! $this->_page->hasFrames() || (strtolower($frame) == '_top')) { 285 return $this->_loadPage($method, $url, $parameters); 286 } 287 return $this->_loadFrame(array($frame), $method, $url, $parameters); 288 } 289 290 /** 291 * Fetches a page and makes it the current page/frame. 292 * @param string $method GET or POST. 293 * @param string/SimpleUrl $url Target to fetch as string. 294 * @param SimpleFormEncoding $parameters POST parameters. 295 * @return string Raw content of page. 296 * @access private 297 */ 298 function _loadPage($method, $url, $parameters = false) { 299 $this->_page = &$this->_fetch(strtoupper($method), $url, $parameters); 300 $this->_history->recordEntry( 301 $this->_page->getMethod(), 302 $this->_page->getUrl(), 303 $this->_page->getRequestData()); 304 return $this->_page->getRaw(); 305 } 306 307 /** 308 * Fetches a frame into the existing frameset replacing the 309 * original. 310 * @param array $frames List of names to drill down. 311 * @param string $method GET or POST. 312 * @param string/SimpleUrl $url Target to fetch as string. 313 * @param SimpleFormEncoding $parameters POST parameters. 314 * @return string Raw content of page. 315 * @access private 316 */ 317 function _loadFrame($frames, $method, $url, $parameters = false) { 318 $page = &$this->_fetch(strtoupper($method), $url, $parameters); 336 function _loadFrame($frames, $url, $parameters) { 337 $page = &$this->_fetch($url, $parameters); 319 338 $this->_page->setFrame($frames, $page); 320 339 } … … 436 455 * Will affect cookies, but will not change the base URL. 437 456 * @param string/SimpleUrl $url Target to fetch as string. 438 * @param hash/Simple FormEncoding $parameters Additional parameters for457 * @param hash/SimpleHeadEncoding $parameters Additional parameters for 439 458 * HEAD request. 440 459 * @return boolean True if successful. … … 445 464 $url = new SimpleUrl($url); 446 465 } 447 if (is_array($parameters)) {448 $parameters = new SimpleFormEncoding($parameters);449 }450 466 if ($this->getUrl()) { 451 467 $url = $url->makeAbsolute($this->getUrl()); 452 468 } 453 $response = &$this->_user_agent->fetchResponse( 454 'HEAD', 455 $url, 456 $parameters); 469 $response = &$this->_user_agent->fetchResponse($url, new SimpleHeadEncoding($parameters)); 457 470 return ! $response->isError(); 458 471 } … … 470 483 $url = new SimpleUrl($url); 471 484 } 472 if (is_array($parameters)) {473 $parameters = new SimpleFormEncoding($parameters);474 }475 485 if ($this->getUrl()) { 476 486 $url = $url->makeAbsolute($this->getUrl()); 477 487 } 478 return $this->_load( 'GET', $url, $parameters);488 return $this->_load($url, new SimpleGetEncoding($parameters)); 479 489 } 480 490 … … 490 500 $url = new SimpleUrl($url); 491 501 } 492 if (is_array($parameters)) {493 $parameters = new SimpleFormEncoding($parameters);494 }495 502 if ($this->getUrl()) { 496 503 $url = $url->makeAbsolute($this->getUrl()); 497 504 } 498 return $this->_load( 'POST', $url, $parameters);505 return $this->_load($url, new SimplePostEncoding($parameters)); 499 506 } 500 507 … … 512 519 $this->_loadFrame( 513 520 $frames, 514 $this->_page->getMethod(),515 521 $this->_page->getUrl(), 516 522 $this->_page->getRequestData()); 517 523 return $this->_page->getRaw(); 518 524 } 519 if ($method = $this->_history->getMethod()) { 520 $this->_page = &$this->_fetch( 521 $method, 522 $this->_history->getUrl(), 523 $this->_history->getParameters()); 525 if ($url = $this->_history->getUrl()) { 526 $this->_page = &$this->_fetch($url, $this->_history->getParameters()); 524 527 return $this->_page->getRaw(); 525 528 } … … 530 533 * Equivalent to hitting the back button on the 531 534 * browser. The browser history is unchanged on 532 * failure. 535 * failure. The page content is refetched as there 536 * is no concept of content caching in SimpleTest. 533 537 * @return boolean True if history entry and 534 538 * fetch succeeded … … 549 553 * Equivalent to hitting the forward button on the 550 554 * browser. The browser history is unchanged on 551 * failure. 555 * failure. The page content is refetched as there 556 * is no concept of content caching in SimpleTest. 552 557 * @return boolean True if history entry and 553 558 * fetch succeeded … … 766 771 /** 767 772 * Sets all form fields with that name. 773 * @param string $label Name or label of field in forms. 774 * @param string $value New value of field. 775 * @return boolean True if field exists, otherwise false. 776 * @access public 777 */ 778 function setField($label, $value) { 779 return $this->_page->setField(new SimpleByLabelOrName($label), $value); 780 } 781 782 /** 783 * Sets all form fields with that name. Will use label if 784 * one is available (not yet implemented). 768 785 * @param string $name Name of field in forms. 769 786 * @param string $value New value of field. … … 771 788 * @access public 772 789 */ 773 function setField ($name, $value) {774 return $this->_page->setField( $name, $value);790 function setFieldByName($name, $value) { 791 return $this->_page->setField(new SimpleByName($name), $value); 775 792 } 776 793 … … 783 800 */ 784 801 function setFieldById($id, $value) { 785 return $this->_page->setFieldById($id, $value); 802 return $this->_page->setField(new SimpleById($id), $value); 803 } 804 805 /** 806 * Accessor for a form element value within the page. 807 * Finds the first match. 808 * @param string $label Field label. 809 * @return string/boolean A value if the field is 810 * present, false if unchecked 811 * and null if missing. 812 * @access public 813 */ 814 function getField($label) { 815 return $this->_page->getField(new SimpleByLabelOrName($label)); 786 816 } 787 817 … … 795 825 * @access public 796 826 */ 797 function getField ($name) {798 return $this->_page->getField( $name);827 function getFieldByName($name) { 828 return $this->_page->getField(new SimpleByName($name)); 799 829 } 800 830 … … 808 838 */ 809 839 function getFieldById($id) { 810 return $this->_page->getField ById($id);840 return $this->_page->getField(new SimpleById($id)); 811 841 } 812 842 … … 821 851 */ 822 852 function clickSubmit($label = 'Submit', $additional = false) { 823 if (! ($form = &$this->_page->getFormBySubmit Label($label))) {853 if (! ($form = &$this->_page->getFormBySubmit(new SimpleByLabel($label)))) { 824 854 return false; 825 855 } 826 856 $success = $this->_load( 827 $form->getMethod(),828 857 $form->getAction(), 829 $form->submitButton ByLabel($label, $additional));858 $form->submitButton(new SimpleByLabel($label), $additional)); 830 859 return ($success ? $this->getContent() : $success); 831 860 } … … 840 869 */ 841 870 function clickSubmitByName($name, $additional = false) { 842 if (! ($form = &$this->_page->getFormBySubmit Name($name))) {871 if (! ($form = &$this->_page->getFormBySubmit(new SimpleByName($name)))) { 843 872 return false; 844 873 } 845 874 $success = $this->_load( 846 $form->getMethod(),847 875 $form->getAction(), 848 $form->submitButton ByName($name, $additional));876 $form->submitButton(new SimpleByName($name), $additional)); 849 877 return ($success ? $this->getContent() : $success); 850 878 } … … 859 887 */ 860 888 function clickSubmitById($id, $additional = false) { 861 if (! ($form = &$this->_page->getFormBySubmit Id($id))) {889 if (! ($form = &$this->_page->getFormBySubmit(new SimpleById($id)))) { 862 890 return false; 863 891 } 864 892 $success = $this->_load( 865 $form->getMethod(),866 893 $form->getAction(), 867 $form->submitButton ById($id, $additional));894 $form->submitButton(new SimpleById($id), $additional)); 868 895 return ($success ? $this->getContent() : $success); 869 896 } … … 883 910 */ 884 911 function clickImage($label, $x = 1, $y = 1, $additional = false) { 885 if (! ($form = &$this->_page->getFormByImage Label($label))) {912 if (! ($form = &$this->_page->getFormByImage(new SimpleByLabel($label)))) { 886 913 return false; 887 914 } 888 915 $success = $this->_load( 889 $form->getMethod(),890 916 $form->getAction(), 891 $form->submitImage ByLabel($label, $x, $y, $addi
