TestAuthComponent.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * TestAuthComponent
  4. *
  5. * PHP 5
  6. *
  7. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  8. * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. *
  10. * Licensed under The MIT License
  11. * Redistributions of files must retain the above copyright notice.
  12. *
  13. * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  14. * @link http://cakephp.org CakePHP(tm) Project
  15. * @since CakePHP(tm) v 3.0.0
  16. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  17. */
  18. namespace TestApp\Controller\Component;
  19. use Cake\Controller\Component\AuthComponent;
  20. /**
  21. * TestAuthComponent class
  22. *
  23. */
  24. class TestAuthComponent extends AuthComponent {
  25. /**
  26. * testStop property
  27. *
  28. * @var bool false
  29. */
  30. public $testStop = false;
  31. /**
  32. * Helper method to add/set an authenticate object instance
  33. *
  34. * @param integer $index The index at which to add/set the object
  35. * @param Object $object The object to add/set
  36. * @return void
  37. */
  38. public function setAuthenticateObject($index, $object) {
  39. $this->_authenticateObjects[$index] = $object;
  40. }
  41. /**
  42. * Helper method to add/set an authorize object instance
  43. *
  44. * @param integer $index The index at which to add/set the object
  45. * @param Object $object The object to add/set
  46. * @return void
  47. */
  48. public function setAuthorizeObject($index, $object) {
  49. $this->_authorizeObjects[$index] = $object;
  50. }
  51. /**
  52. * stop method
  53. *
  54. * @return void
  55. */
  56. protected function _stop($status = 0) {
  57. $this->testStop = true;
  58. }
  59. public static function clearUser() {
  60. static::$_user = array();
  61. }
  62. }