PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/global/urlfor.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 30 lines | 25 code | 5 blank | 0 comment | 0 complexity | 37e1bbfd7479fe1eb3a9aeedecc2ad90 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfset loc.original_routes = duplicate(application.wheels.routes)>
  4. <cfset loc.original_rewrite = application.wheels.URLRewriting>
  5. <cfset application.wheels.URLRewriting = "On">
  6. </cffunction>
  7. <cffunction name="teardown">
  8. <cfset application.wheels.routes = loc.original_routes>
  9. <cfset application.wheels.URLRewriting = loc.original_rewrite>
  10. </cffunction>
  11. <cffunction name="test_links_are_properly_hyphenated">
  12. <cfset addRoute(name="user_2", pattern="user/[user_id]/[controller]/[action]")>
  13. <cfset $setNamedRoutePositions()>
  14. <cfset loc.e = "/user/5559/survey-templates/index">
  15. <cfset loc.r = urlFor(route="user_2", user_id="5559", controller="SurveyTemplates", action="index")>
  16. <cfset assert('loc.r contains loc.e')>
  17. </cffunction>
  18. <cffunction name="test_format_properly_add_with_route">
  19. <cfset addRoute(name="user_2", pattern="user/[user_id]/[controller]/[action].[format]")>
  20. <cfset $setNamedRoutePositions()>
  21. <cfset loc.e = "/user/5559/survey-templates/index.csv">
  22. <cfset loc.r = urlFor(route="user_2", user_id="5559", controller="SurveyTemplates", action="index", format="csv")>
  23. <cfset assert('loc.r contains loc.e')>
  24. </cffunction>
  25. </cfcomponent>