Injector support for CFEasyMock

I've updated the reflect package to use an Injector component to do the work of populating the proxy method catalog. The proxy can be created with an external injector as well.

Sooo... this means that CFEasyMock now has been updated to take advantage of this hook. The new version 1.1 adds three new MockFactory methods to create mocks with an injector.

<cfset mf = createObject( "component", "easymock.MockFactory" ) />

<cfset injector = createObject( "sample.FunctionDataLoader" ).init( aFuncArrayYouCreate ) />

<cfset mock = mf.createInjectedMock( "sample.Collaborator", injector ) />

<cfset mock = mf.createInjectedStrictMock( "sample.Collaborator", injector ) />

<cfset mock = mf.createInjectedNiceMock( "sample.Collaborator", injector ) />

I've supplied the MetaDataInjector with the reflect package, which uses it internally as well. In the sample folder there is a FunctionDataInjector, which extends MetaDataInjector and can inject from just a function array (the data structure format from the metadata results of getMetaData() ).

Some of you have asked for injection, so now you can create your own injectors and use them in your mocks.

BlogCFC was created by Raymond Camden. This blog is running version 5.5.006. | Protected by Akismet | Blog with WordPress