MockBox can have many amazing uses. One well documented use is in assistance
in creating complicated unit tests insuring you are only testing one small unit of work, it can be used for many other interesting use cases.
One of the ways we find MockBox useful during our development cycle at Computer Know How is to Mock objects we haven't had the time to complete yet, but we do know what we expect as response. This allows us to continue development without waiting for the piece of something we haven't done yet slow us down, but keep the method calls exactly as they will be in when the object is complete.
So, how do you use MockBox outside of the context of a unit test? Well, its easy.
Inside a ColdBox application.
//get an instance of mockbox to use for mocking things not 100% built yet inside a ColdBox app
mockBox = createObject("component","coldbox.system.testing.MockBox").init();
Outside a ColdBox application.
//get an instance of mockbox to use for mocking things not 100% built yet outside a ColdBox app.
mockBox = createObject("component","mockbox.system.testing.MockBox").init();
Now that MockBox is initialized, we can start mocking objects. Lets say we have a User Object that we haven't had time to build yet. Right now it looks really advanced with lots of cool properties and functions that we spent a ton of time on. Something like this.
cfcomponent hint="I am the User ORM cfc"
/cfcomponent