1. sfTester.class.php
  2. /** * sfTester is the base class for all tester classes. * * @package symfony * @subpackage test * @author Fabien Potencier * @version SVN: $Id: sfTester.class.php 13691 2008-12-03 22:17:01Z Kris.Wallsmith $ */
  3. abstract class sfTester
  4. {
  5. protected
  6. $inABlock = false,
  7. $browser = null,
  8. $tester = null;
  9. /**
  10. * Constructor.
  11. *
  12. * @param sfTestFunctionalBase $browser A browser
  13. * @param lime_test $tester A tester object
  14. */
  15. public function __construct(sfTestFunctionalBase $browser, $tester)
  16. {
  17. $this->browser = $browser;
  18. $this->tester = $tester;
  19. }
  20. /**
  21. * Prepares the tester.
  22. */
  23. abstract public function prepare();
  24. /**
  25. * Initializes the tester.
  26. */
  27. abstract public function initialize();
  28. /**
  29. * Begins a block.
  30. *
  31. * @return sfTester This sfTester instance
  32. */
  33. public function begin()
  34. {
  35. $this->inABlock = true;
  36. return $this->browser->begin();
  37. }
  38. /**
  39. * Ends a block.
  40. *
  41. * @param sfTestFunctionalBase
  42. */
  43. public function end()
  44. {
  45. $this->inABlock = false;
  46. return $this->browser->end();
  47. }
  48. /**
  49. * Returns the object that each test method must return.
  50. *
  51. * @return sfTestFunctionalBase|sfTester
  52. */
  53. public function getObjectToReturn()
  54. {
  55. return $this->inABlock ? $this : $this->browser;
  56. }
  57. public function __call($method, $arguments)
  58. {
  59. call_user_func_array(array($this->browser, $method), $arguments);
  60. return $this->getObjectToReturn();
  61. }
  62. }

Debug toolbar