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

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

http://cfwheels.googlecode.com/
ColdFusion CFScript | 18 lines | 15 code | 3 blank | 0 comment | 0 complexity | 5bc4898726b0680efd923cb02bcc6d78 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_addObject_valid">
  6. <cfset loc.author = loc.authorModel.findOne(where="firstName = 'James'")>
  7. <cfset loc.post = model("post").findOne()>
  8. <cftransaction action="begin">
  9. <cfset loc.updated = loc.author.addPost(loc.post) />
  10. <cfset assert('loc.updated eq true')>
  11. <cfset assert('loc.post.authorid eq loc.author.id')>
  12. <cftransaction action="rollback" />
  13. </cftransaction>
  14. </cffunction>
  15. </cfcomponent>