So I currently have this code:
MockContext = getController().getRequestService().getContext();
MockRequestService = getMockBox().createEmptyMock(“coldbox.system.web.services.RequestService”).$(“getContext”,MockContext);
var prc = MockContext.getCollection(private=true);
And it seemed to work initially, but it seems our custom RequestContext (which extends coldbox.system.web.context.RequestContextDecorator) is not seeing the same prc as the tests.
I’ve tried this but it doesn’t appear to work:
MockRequestContext = getMockBox().prepareMock( createObject(“component”,“path.to.CustomRequestContext”) );
var prc = MockContext.getCollection(private=true);
MockRequestContext.$property(propertyName=“instance.privateContext”,mock=prc);
Is that the right approach, or does something else need doing?