Some Examples
The Collaborator
//hard to mock in a method call
function checkEmail(email){
var validator = createObject("component","model.util.Validator");
return validator.isEmail(arguments.email);
}<cfproperty name="Validator" type="model" instance="scope" />
//or setter injection
<cffunction name="setValidator" access="public" returntype="void" output="false">
<cfargument name="validator" type="any">
<cfset instance.validator = arguments.validator>
</cffunction>Method Spies
Last updated
Was this helpful?