Changeset 11902
- Timestamp:
- 10/02/08 13:43:20 (5 years ago)
- Files:
-
- branches/1.2/lib/test/sfTestFunctionalBase.class.php (modified) (3 diffs)
- branches/1.2/lib/util/sfBrowserBase.class.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/lib/test/sfTestFunctionalBase.class.php
r11900 r11902 240 240 241 241 /** 242 * Simulates a click on a link or button. 243 * 244 * @param string $name The link or button text 245 * @param array $arguments The arguments to pass to the link 246 * @param array $options An array of options 247 * 248 * @return sfBrowser 249 */ 250 public function click($name, $arguments = array(), $options = array()) 251 { 252 list($uri, $method, $parameters) = $this->browser->doClick($name, $arguments, $options); 253 254 return $this->call($uri, $method, $parameters); 255 } 256 257 /** 242 258 * Simulates the browser back button. 243 259 * … … 248 264 $this->test()->comment('back'); 249 265 250 return $this->browser->back(); 266 $this->browser->back(); 267 268 return $this; 251 269 } 252 270 … … 260 278 $this->test()->comment('forward'); 261 279 262 return $this->browser->forward(); 280 $this->browser->forward(); 281 282 return $this; 263 283 } 264 284 branches/1.2/lib/util/sfBrowserBase.class.php
r11901 r11902 542 542 * Simulates a click on a link or button. 543 543 * 544 * @param string $name The link or button text 545 * @param array $arguments The arguments to pass to the link 546 * @param array $options An array of options 547 * 548 * @return sfBrowser 549 * 550 * @see doClick() 551 */ 552 public function click($name, $arguments = array(), $options = array()) 553 { 554 list($uri, $method, $parameters) = $this->doClick($name, $arguments, $options); 555 556 $this->call($uri, $method, $parameters); 557 } 558 559 /** 560 * Simulates a click on a link or button. 561 * 562 * This method is called internally by the click() method. 563 * 544 564 * Available options: 545 565 * … … 553 573 * @param array $options An array of options 554 574 * 555 * @return sfBrowser556 */ 557 public function click($name, $arguments = array(), $options = array())575 * @return array An array composed of the URI, the method and the arguments to pass to the call() call 576 */ 577 public function doClick($name, $arguments = array(), $options = array()) 558 578 { 559 579 $position = isset($options['position']) ? $options['position'] - 1 : 0; … … 575 595 if (in_array($method, array('post', 'put', 'delete'))) 576 596 { 577 return $this->call($link->getAttribute('href'), $method, $arguments);597 return array($link->getAttribute('href'), $method, $arguments); 578 598 } 579 599 else 580 600 { 581 return $this->get($link->getAttribute('href'));601 return array($link->getAttribute('href'), 'get', array()); 582 602 } 583 603 } … … 588 608 if (in_array($method, array('post', 'put', 'delete'))) 589 609 { 590 return $this->call($link->getAttribute('href'), $method, $arguments);610 return array($link->getAttribute('href'), $method, $arguments); 591 611 } 592 612 else 593 613 { 594 return $this->get($link->getAttribute('href'));614 return array($link->getAttribute('href'), 'get', $arguments); 595 615 } 596 616 } … … 710 730 if (in_array($method, array('post', 'put', 'delete'))) 711 731 { 712 return $this->call($url, $method, $arguments);732 return array($url, $method, $arguments); 713 733 } 714 734 else … … 717 737 $sep = false === strpos($url, '?') ? '?' : '&'; 718 738 719 return $this->get($url.($queryString ? $sep.$queryString : ''));739 return array($url.($queryString ? $sep.$queryString : ''), 'get', array()); 720 740 } 721 741 }