/wheels/tests/model/onmissingmethod/hasMany/deleteobject.cfc

http://cfwheels.googlecode.com/ · ColdFusion CFScript · 19 lines · 16 code · 3 blank · 0 comment · 0 complexity · 54869a2ef95538a5d75cb06cf4c2c207 MD5 · raw file

  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfset loc.authorModel = model("author")>
  4. </cffunction>
  5. <cffunction name="test_deleteObject_valid">
  6. <cfset loc.author = loc.authorModel.findOne(where="firstName = 'Per'")>
  7. <cfset loc.post = loc.author.findOnePost(order="id")>
  8. <cftransaction action="begin">
  9. <cfset loc.updated = loc.author.deletePost(loc.post) />
  10. <cfset loc.post = model("post").findByKey(key=loc.post.id) />
  11. <cfset assert('loc.updated eq true')>
  12. <cfset assert('not IsObject(loc.post) and loc.post eq false')>
  13. <cftransaction action="rollback" />
  14. </cftransaction>
  15. </cffunction>
  16. </cfcomponent>