[mockbox 2.2] Mocking an interface that implements another interface

I am having an issue using mockbox to mock an interface that implements another interface.

I am doing something like this:

mockSearchable = mockbox.createStub(implements=“ISearchable”);

ISearchable.cfc:

interface extends=“IPermissible”{

}

IPermissible.cfc:

interface {
boolean function checkPermission(required number userID);
}

And I get the following error which seems to indicate that createStub is not mocking the methods of the extended interface:

component [C:\inetpub\wwwroot\coldbox\system\testing\stubs\822EF881-060B-4017-AA17A33D85186F7C.cfc] does not implement the function [checkpermission(number userid)] of the interface [C:\inetpub\wwwroot\myProject\IPermissible.cfc]

Is it possible to do this using MockBox? I am currently working around the issue by redefining any methods from the parent interface on child interfaces but doing this is kind of ugly and verbose.

Thanks.

Can you put in a ticket for this? The mock is generated in MockGenerator.cfc which pulls the metadata via the generateMethodsFromMD() method which recurses on the “extends” attribute, but I don’t see anything about “implements” in there.

https://ortussolutions.atlassian.net/browse/MOCKBOX

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Thanks Brad. Maybe I’m missing something but I created an account but I seem to be getting a read-only view in JIRA and I see no option to open a new ticket.

Sorry about that. JIRA’s security is both powerful and a pain in the butt. I have made an adjustment. Try again and see if you can add a new ticket now.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Thanks Brad,

The ticket has been created: [TESTBOX-140] Allow Mocking of an Interface that implements another interface - Welcome