PageRenderTime 26ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/model/crud/findonebyxxx.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 42 lines | 33 code | 9 blank | 0 comment | 0 complexity | 1c1b4422e3e5d6cf068c0427792977ac MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfset results = {}>
  4. </cffunction>
  5. <cffunction name="test_one_value">
  6. <cfset results.user = model("user").findOneByFirstname('Per')>
  7. <cfset assert("IsObject(results.user)")>
  8. </cffunction>
  9. <cffunction name="test_explicit_arguments">
  10. <cfset results.user = model("user").findOneByZipCode(value="22222", select="id,lastName,zipCode")>
  11. <cfset assert("IsObject(results.user) AND results.user.lastName IS 'Peters' AND NOT StructKeyExists(results.user, 'firstName')")>
  12. </cffunction>
  13. <cffunction name="test_pass_through_order">
  14. <cfset results.user = model("user").findOneByIsActive(value="1", order="zipCode DESC")>
  15. <cfset assert("IsObject(results.user) AND results.user.lastName IS 'Riera'")>
  16. </cffunction>
  17. <cffunction name="test_two_values">
  18. <cfset results.user = model("user").findOneByFirstNameAndLastName("Per,Djurner")>
  19. <cfset assert("IsObject(results.user) AND results.user.lastName IS 'Djurner'")>
  20. </cffunction>
  21. <cffunction name="test_two_values_with_space">
  22. <cfset results.user = model("user").findOneByFirstNameAndLastName("Per, Djurner")>
  23. <cfset assert("IsObject(results.user) AND results.user.lastName IS 'Djurner'")>
  24. </cffunction>
  25. <cffunction name="test_two_values_with_explicit_arguments">
  26. <cfset results.user = model("user").findOneByFirstNameAndLastName(values="Per,Djurner")>
  27. <cfset assert("IsObject(results.user) AND results.user.lastName IS 'Djurner'")>
  28. </cffunction>
  29. <cffunction name="test_text_data_type">
  30. <cfset results.profile = model("profile").findOneByBio("ColdFusion Developer")>
  31. <cfset assert("IsObject(results.profile)")>
  32. </cffunction>
  33. </cfcomponent>