PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/model/properties/protectedproperties.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 21 lines | 18 code | 3 blank | 0 comment | 0 complexity | 93fd01a1394ee9310333fc662c0ee2e1 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="test_property_cannot_be_set_with_mass_assignment_when_protected">
 4		<cfset loc.model = model("post") />
 5		<cfset loc.model = duplicate(loc.model)>
 6		<cfset loc.model.protectedProperties(properties="views") />
 7		<cfset loc.properties = { views = "2000" } />
 8		<cfset loc.model = loc.model.new(properties=loc.properties) />
 9		<cfset assert('StructKeyExists(loc.model, "views") eq false') />
10	</cffunction>
11
12	<cffunction name="test_property_can_be_set_directly">
13		<cfset loc.model = model("post") />
14		<cfset loc.model = duplicate(loc.model)>
15		<cfset loc.model.protectedProperties(properties="views") />
16		<cfset loc.model = loc.model.new() />
17		<cfset loc.model.views = 2000 />
18		<cfset assert('StructKeyExists(loc.model, "views") eq true') />
19	</cffunction>
20
21</cfcomponent>