routes.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * routes for test units
  4. */
  5. return array(
  6. /**
  7. * wildcard test
  8. */
  9. 'GET /test/wildcard/(:num)/(:any)' => function($id, $name)
  10. {
  11. return $id . '/' . $name;
  12. },
  13. /**
  14. * regex wildcard
  15. */
  16. 'GET /test/wildcard/([a-z]{3}[0-9]{3})' => function($id)
  17. {
  18. return $id;
  19. },
  20. /**
  21. * wildcard with optional parameter
  22. */
  23. 'GET /test/optwildcard/(:any?)' => function($value = '')
  24. {
  25. return $value;
  26. },
  27. /**
  28. * direct path test
  29. */
  30. 'GET /test/direct' => function()
  31. {
  32. return 'direct';
  33. },
  34. /**
  35. * multiple routes in one
  36. */
  37. 'GET /test/multi, GET /test/altmulti' => function()
  38. {
  39. return 'multi test';
  40. },
  41. /**
  42. * post request
  43. */
  44. 'POST /test/postrequest' => function()
  45. {
  46. return 'POST request';
  47. },
  48. /**
  49. * PUT request
  50. */
  51. 'PUT /test/putrequest' => function()
  52. {
  53. return 'PUT request';
  54. },
  55. /**
  56. * before filter
  57. */
  58. 'GET /test/filter/before' => array('before' => 'before_filter', function()
  59. {
  60. return 'not filtered';
  61. }),
  62. /**
  63. * after filter
  64. */
  65. 'GET /test/filter/after' => array('after' => 'after_filter', function()
  66. {
  67. return 'not filtered';
  68. }),
  69. /**
  70. * multiple filters
  71. */
  72. 'GET /test/filter/multi' => array('after' => 'after_filter, after_filter2', function()
  73. {
  74. return 'not filtered';
  75. }),
  76. );