PageRenderTime 30ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

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

http://cfwheels.googlecode.com/
ColdFusion CFScript | 19 lines | 16 code | 3 blank | 0 comment | 0 complexity | 16e22bf51ae9b9af68903684428a2e0c MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfset loc.authorModel = model("author")>
  4. </cffunction>
  5. <cffunction name="test_removeObject_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.removePost(loc.post) />
  10. <cfset loc.post.reload() />
  11. <cfset assert('loc.updated eq true')>
  12. <cfset assert('loc.post.authorid eq ""')>
  13. <cftransaction action="rollback" />
  14. </cftransaction>
  15. </cffunction>
  16. </cfcomponent>