mocking with UDF libraries

I got my mocks almost setup but I am having trouble getting UDFs that are apart of the handlers to appear within the mock.

When the mock runs, it fails with the following error::

No matching Method/Function [ADDASSETLIBRARY] for call with named arguments found

which is a custom function within my udf file.

how do I tell mockbox to include that UDF when it runs the test?


Jeremy R. DeYoung
Phone:615.261.8201

RantsFromAMadMan.com

are you doing integration testing or targeted handler testing?

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

i honestly am not sure i understand the difference … i’m trying to test a specific handler named report.cfc however main.cfc is being called so i suspect I am trying to do a handler test but its testing everything?

i’m really trying to get my mind wrapped around mocking and i’m on the verge of getting it b/c I think i’m missing a few pieces.

Here is my report test:

component extends=“coldbox.system.testing.BaseTestCase” handler=“report”{

function setup() output=“false” {

super.setup();

}

function index() output=“false” {

event = execute(“report.index”);

debug(event.getCollection());

}

}


Jeremy R. DeYoung
Phone:615.261.8201

RantsFromAMadMan.com

Ok, here is the problem

The BaseTestCase is the test case used for integration testing = Testing of the entire application from the ground up. This will create a virtual application with caching, DI, etc. and try to execute events. The handler annotation in your test does actually nothing unless you are doing a UNIT test of the handler which you should then be using the BaseHandlerTest as your parent.

So you are mixing your tests here. That is why main is firing, because it is firing the full life cycle. So the question is, are you trying to test everything top-down or just the Report handler in isolation, with no DI, no nothing, just the plain old handler.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano