Ok seems like nobody picked it up and I can now tell you what the actual
problem is, I really love it when people don't try things and really just
make assumptions...
But maybe I should have made this a little clearer to begin with.
My first unit test was this, and it worked. Reason the preprocess picked up
the variable being set, if I removed it, it then threw the error as it was
expecting the variable spaceUrl.
var rc = instance.event.getCollection();
rc.spaceUrl = 'AndyScott';
event = execute('blog:blogComment.index');
Now to get the actual event to work I have to pass in a form, the following
whether it is rc, form, url will not work.
var rc = instance.event.getCollection();
rc.spaceUrl = 'AndyScott';
//Setup the form to test for a valid comment
form = {
name = 'Andrew Scott',
email = 'andy@stiff.com.ua',
website = '',
comment = 'weeeeeee',
rememberInfo = false,
commentSubscribe = false,
blogEntryId = 1
};
event = execute('blog:blogComment.index');
As this is a unit test that is being run from eclipse, and not via a URL
which I think a lot of people made the assumption on. Anyway to get this to
work it appears one has to actually do this.
var rc = instance.event.getCollection();
rc.spaceUrl = 'AndyScott';
//Setup the form to test for a valid comment
form = {
name = 'Andrew Scott',
email = 'andy@stiff.com.ua',
website = '',
comment = 'weeeeeee',
rememberInfo = false,
commentSubscribe = false,
blogEntryId = 1
};
structAppend(rc, form);
event = execute('blog:blogComment.index');
It appears that even though this works when dumping the struct
rc.spaceUrl = 'AndyScott';
//Setup the form to test for a valid comment
rc = {
name = 'Andrew Scott',
email = 'andy@stiff.com.ua',
website = '',
comment = 'weeeeeee',
rememberInfo = false,
commentSubscribe = false,
blogEntryId = 1
};
As it shows all the variables in the RC, but ColdBox or ColdFusion somehow
when eventually going across doesn't see the new added vars for some reason.
Regards,
Andrew Scott
<http://www.andyscott.id.au/> http://www.andyscott.id.au/
Of Curt Gratz