[TestBox v1.1.0.00076] Testing service layer

I’m having some problems getting up and running with TestBox.

I have set up my test app with it’s own Application.cfc and I can execute an event on the root app and perform expectations on the event result, which is great.

Now I want to test a specific method on one of my service objects i.e. not execute a full event. This service object has a dependency on another object. When I try and test the method, I get an error saying that the dependency cannot be found.

I guess that because it isn’t an event, wirebox is not available.

So my questions are:
Should the Application.cfc inside the test folder instantiate Coldbox, or not?
If not, how do I make my service object aware of wirebox when testing.

Thanks.

If you are doing unit tests, you will need to mock any dependencies using MockBox.

http://wiki.coldbox.org/wiki/MockBox.cfm#.24property()

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Works great, thanks.