PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/model/crud/create.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 31 lines | 26 code | 5 blank | 0 comment | 0 complexity | 7f73eaf37775d265a220c2bc21b40e74 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfset results = {}>
  4. </cffunction>
  5. <cffunction name="test_auto_incrementing_primary_key_should_be_set">
  6. <cftransaction>
  7. <cfset results.author = model("author").create(firstName="Test", lastName="Test")>
  8. <cfset assert("IsObject(results.author) AND StructKeyExists(results.author, results.author.primaryKey()) AND IsNumeric(results.author[results.author.primaryKey()])")>
  9. <cftransaction action="rollback" />
  10. </cftransaction>
  11. </cffunction>
  12. <cffunction name="test_non_auto_incrementing_primary_key_should_not_be_changed">
  13. <cftransaction>
  14. <cfset results.shop = model("shop").create(ShopId=99, CityCode=99, Name="Test")>
  15. <cfset assert("IsObject(results.shop) AND StructKeyExists(results.shop, results.shop.primaryKey()) AND results.shop[results.shop.primaryKey()] IS 99")>
  16. <cftransaction action="rollback" />
  17. </cftransaction>
  18. </cffunction>
  19. <cffunction name="test_composite_key_values_should_be_set_when_they_both_exist">
  20. <cftransaction>
  21. <cfset results.city = model("city").create(citycode=99, countyid="z", name="test")>
  22. <cfset assert("results.city.citycode IS 99 AND results.city.countyid IS 'z'")>
  23. <cftransaction action="rollback" />
  24. </cftransaction>
  25. </cffunction>
  26. </cfcomponent>