MockDispatcher.php 858 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Lithium: the most rad php framework
  4. *
  5. * @copyright Copyright 2009, Union of RAD (http://union-of-rad.org)
  6. * @license http://opensource.org/licenses/bsd-license.php The BSD License
  7. */
  8. namespace lithium\tests\mocks\action;
  9. use stdClass;
  10. class MockDispatcher extends \lithium\action\Dispatcher {
  11. /**
  12. * Reset Dispatcher's rules.
  13. *
  14. * @var array
  15. */
  16. protected static $_rules = array();
  17. public static $dispatched = array();
  18. protected static function _callable($request, $params, $options) {
  19. $callable = new stdClass();
  20. $callable->params = $params;
  21. return $callable;
  22. }
  23. protected static function _call($callable, $request, $params) {
  24. if (is_callable($callable->params['controller'])) {
  25. return parent::_call($callable->params['controller'], $request, $params);
  26. }
  27. static::$dispatched[] = $callable;
  28. }
  29. }
  30. ?>