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

/wheels/tests/model/callbacks/beforeCreate.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 21 lines | 16 code | 5 blank | 0 comment | 0 complexity | 42970f67301ca13fdc205a71cd14c4c7 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="beforeCreate", methods="callbackThatSetsProperty, callbackThatReturnsFalse")>
  4. </cffunction>
  5. <cffunction name="teardown">
  6. <cfset model("tag").$clearCallbacks(type="beforeCreate")>
  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>