PageRenderTime 217ms CodeModel.GetById 136ms app.highlight 0ms RepoModel.GetById 80ms app.codeStats 0ms

/wheels/tests/model/crud/properties.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 30 lines | 26 code | 4 blank | 0 comment | 0 complexity | 852958ecafaa6c4ae5e7e9adc723da5c MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2 
 3 	<cffunction name="test_updateProperty">
 4		<cftransaction action="begin">
 5			<cfset loc.author = model("Author").findOne(where="firstName='Andy'")>
 6			<cfset loc.saved = loc.author.updateProperty("firstName", "Frog")>
 7			<cftransaction action="rollback" />
 8		</cftransaction>
 9		<cfset assert('loc.saved eq true and loc.author.firstName eq "Frog"')>
10	</cffunction>
11 
12 	<cffunction name="test_updateProperty_dynamic_method">
13		<cftransaction action="begin">
14			<cfset loc.author = model("Author").findOne(where="firstName='Andy'")>
15			<cfset loc.saved = loc.author.updateFirstName(value="Frog")>
16			<cftransaction action="rollback" />
17		</cftransaction>
18		<cfset assert('loc.saved eq true and loc.author.firstName eq "Frog"')>
19	</cffunction>
20 
21 	<cffunction name="test_updateProperties">
22		<cftransaction action="begin">
23			<cfset loc.author = model("Author").findOne(where="firstName='Andy'")>
24			<cfset loc.saved = loc.author.updateProperties(firstName="Kirmit", lastName="Frog")>
25			<cftransaction action="rollback" />
26		</cftransaction>
27		<cfset assert('loc.saved eq true and loc.author.lastName eq "Frog" and loc.author.firstName eq "Kirmit"')>
28	</cffunction>
29
30</cfcomponent>