Of, I have a CFC with a method foo that has say six arguments all of which are NOT required. I want to test that whatever called foo() passed at least one of the arguments in its call. Ugh, how? In testing this I called foo() with no arguments and did a dump on arguments. CF output a structure with keys the arguments names and each value as "undefined struct element". Do I have to loop through this struct and test each value? Or is ther a slick approach? Yes, I know I can remove all the cfargument delcarations, but then I loose the type validations.
You need to test structKeyExists(arguments,'argname') to see whether an argument was passed.
Yes, it is a little surprising that structCount(arguments) and arrayLen(arguments) both give at least the number of arguments that you declared, rather than the number of arguments actually passed. It is a known issue (but not very widely known, I guess).
Sean A Corfield -- http://www.corfield.org/blog/
"If you're not annoying somebody, you're not really alive." -- Margaret Atwood
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
