PageRenderTime 93ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/model/callbacks/beforeValidationOnCreate.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 21 lines | 16 code | 5 blank | 0 comment | 0 complexity | b0d1917caa46121a8e134070946132a4 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfset model("tag").$registerCallback(type="beforeValidationOnCreate", methods="callbackThatSetsProperty,callbackThatReturnsFalse")>
  4. </cffunction>
  5. <cffunction name="teardown">
  6. <cfset model("tag").$clearCallbacks(type="beforeValidationOnCreate")>
  7. </cffunction>
  8. <cffunction name="test_new_object">
  9. <cfset loc.obj = model("tag").create()>
  10. <cfset assert("StructKeyExists(loc.obj, 'setByCallback')")>
  11. </cffunction>
  12. <cffunction name="test_new_object_with_skipped_callback">
  13. <cfset loc.obj = model("tag").create(name="mustSetAtLeastOnePropertyOrCreateFails", transaction="rollback", callbacks=false)>
  14. <cfset assert("NOT StructKeyExists(loc.obj, 'setByCallback')")>
  15. </cffunction>
  16. </cfcomponent>