1. sfTestFunctional.class.php
  2. /** * sfTestFunctional tests an application by using a browser simulator. * * @package symfony * @subpackage test * @author Fabien Potencier * @version SVN: $Id: sfTestFunctional.class.php 23937 2009-11-14 17:43:12Z fabien $ */
  3. class sfTestFunctional extends sfTestFunctionalBase
  4. {
  5. /**
  6. * Initializes the browser tester instance.
  7. *
  8. * @param sfBrowserBase $browser A sfBrowserBase instance
  9. * @param lime_test $lime A lime instance
  10. */
  11. public function __construct(sfBrowserBase $browser, lime_test $lime = null, $testers = array())
  12. {
  13. $testers = array_merge(array(
  14. 'view_cache' => 'sfTesterViewCache',
  15. 'form' => 'sfTesterForm',
  16. ), $testers);
  17. parent::__construct($browser, $lime, $testers);
  18. }
  19. /**
  20. * Checks that the request is forwarded to a given module/action.
  21. *
  22. * @param string $moduleName The module name
  23. * @param string $actionName The action name
  24. * @param mixed $position The position in the action stack (default to the last entry)
  25. *
  26. * @return sfTestFunctional The current sfTestFunctional instance
  27. */
  28. public function isForwardedTo($moduleName, $actionName, $position = 'last')
  29. {
  30. $actionStack = $this->browser->getContext()->getActionStack();
  31. switch ($position)
  32. {
  33. case 'first':
  34. $entry = $actionStack->getFirstEntry();
  35. break;
  36. case 'last':
  37. $entry = $actionStack->getLastEntry();
  38. break;
  39. default:
  40. $entry = $actionStack->getEntry($position);
  41. }
  42. $this->test()->is($entry->getModuleName(), $moduleName, sprintf('request is forwarded to the "%s" module (%s)', $moduleName, $position));
  43. $this->test()->is($entry->getActionName(), $actionName, sprintf('request is forwarded to the "%s" action (%s)', $actionName, $position));
  44. return $this;
  45. }
  46. }

Debug toolbar