RequestHandlerTestController.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. *
  5. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  6. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  7. *
  8. * Licensed under The MIT License
  9. * For full copyright and license information, please see the LICENSE.txt
  10. * Redistributions of files must retain the above copyright notice.
  11. *
  12. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  13. * @link http://cakephp.org CakePHP(tm) Project
  14. * @since 3.0.0
  15. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  16. */
  17. namespace TestApp\Controller;
  18. use Cake\Controller\Controller;
  19. /**
  20. * RequestHandlerTestController class
  21. *
  22. */
  23. class RequestHandlerTestController extends Controller
  24. {
  25. /**
  26. * test method for ajax redirection
  27. *
  28. * @return void
  29. */
  30. public function destination()
  31. {
  32. $this->viewBuilder()->templatePath('Posts');
  33. $this->render('index');
  34. }
  35. /**
  36. * test method for ajax redirection + parameter parsing
  37. *
  38. * @param string|null $one
  39. * @param string|null $two
  40. * @return void
  41. */
  42. public function param_method($one = null, $two = null)
  43. {
  44. echo "one: $one two: $two";
  45. $this->autoRender = false;
  46. }
  47. /**
  48. * test method for testing layout rendering when isAjax()
  49. *
  50. * @return void
  51. */
  52. public function ajax2_layout()
  53. {
  54. $this->viewBuilder()->layout('ajax2');
  55. $this->destination();
  56. }
  57. /**
  58. * test method for testing that response type set in action doesn't get
  59. * overridden by RequestHandlerComponent::beforeRender()
  60. *
  61. * @return void
  62. */
  63. public function set_response_type()
  64. {
  65. $this->response->type('txt');
  66. }
  67. }