sfTestBrowser.class.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. require_once(dirname(__FILE__).'/../vendor/lime/lime.php');
  3. /*
  4. * This file is part of the symfony package.
  5. * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * sfTestBrowser simulates a browser which can test a symfony application.
  12. *
  13. * sfTestFunctional is backward compatible class for symfony 1.0, and 1.1.
  14. * For new code, you can use the sfTestFunctional class directly.
  15. *
  16. * @package symfony
  17. * @subpackage test
  18. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  19. * @version SVN: $Id: sfTestBrowser.class.php 15797 2009-02-26 09:28:12Z fabien $
  20. */
  21. class sfTestBrowser extends sfTestFunctional
  22. {
  23. /**
  24. * Initializes the browser tester instance.
  25. *
  26. * @param string $hostname Hostname to browse
  27. * @param string $remote Remote address to spook
  28. * @param array $options Options for sfBrowser
  29. */
  30. public function __construct($hostname = null, $remote = null, $options = array())
  31. {
  32. if (is_object($hostname))
  33. {
  34. // new signature
  35. parent::__construct($hostname, $remote);
  36. }
  37. else
  38. {
  39. $browser = new sfBrowser($hostname, $remote, $options);
  40. if (is_null(self::$test))
  41. {
  42. $lime = new lime_test(null, isset($options['output']) ? $options['output'] : new lime_output_color());
  43. }
  44. else
  45. {
  46. $lime = null;
  47. }
  48. parent::__construct($browser, $lime);
  49. }
  50. }
  51. }