[Testbox-2.1.0] Testing Model Constraints

Hi All,

I’ve hit a little bit of a stumbling block and can’t seem to find a way to test model constraints with the cbvalidation module. Does some have an example of a unit test where they can call validateModel() and receive back everything that the ValidationManager returns?

I’ve tried something like:

validator = new cborm.modules.cbvalidation.models.ValidationManager();

But when I call validator.validateModel( model ) it seems to fail when it hits the resourceService saying it can’t be found.

I’ve also tried having wirebox get access and it can never find the cbvalidation instance by doing:

application.wirebox = new coldbox.system.ioc.Injector();
validator = application.wirebox.getInstance(“ValidationManager@cbvalidation”);

But it can never find that module for some reason.

I’ve even tried using mockWireBox to get the instance and it tells me it can’t find it as well.

Does anyone have an example of doing this they could share so I can see what piece of this I’m missing?


have you seen at the module tests themselves?https://github.com/ColdBox/cbox-validation/tree/master/tests/specs

Luis Majano
Ortus Solutions, Corp
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

That is very helpful, thank you. I had not seen the tests for these.