Hi y'all,
Newbie alert - new to both Unit testing and Coldbox.
After getting 7 or 8 other tests working, I was reading the docs and
discovered you could test methods on the handlers and supply test form/
url data, so I thought I'd give it a go. I am attempting to test a
login authentication method. In the app, I have a form with email and
password inputs, that I pass to an 'auth' method. In the auth method,
I refer to the form fields by the request context, rc.email and
rc.password.
Here is the test method I wrote:
<cffunction name="testAuthEvent" access="public" returntype="void"
output="false">
<cfscript>
var event = "";
form.email = "me@mac.com";
form.password = "password";
event = execute('front.auth');
debug(event.getCollection());
assertEquals("loggedin.home", event.getValue("setnextevent",""),
"Relocation Test");
</cfscript>
</cffunction>
Well, I get an error Expression: Element EMAIL is undefined in RC.
Do I not have it configured correctly, or am I just plain 'doing it
wrong'? Thanks for shedding light on my wayward ways!
Thanks,
JP