use of com.enonic.xp.testing.mock.MockViewFunctionService in project xp by enonic.
the class ScriptTestSupport method initialize.
protected void initialize() throws Exception {
this.serviceRegistry = new MockServiceRegistry();
this.portalRequest = createPortalRequest();
PortalRequestAccessor.set(this.portalRequest);
this.bundleContext = createBundleContext();
this.contentService = Mockito.mock(ContentService.class);
this.resourceService = createResourceService();
addService(ContentService.class, this.contentService);
addService(ResourceService.class, this.resourceService);
addService(ViewFunctionService.class, new MockViewFunctionService());
this.scriptSettings = ScriptSettings.create();
this.scriptSettings.binding(Context.class, ContextAccessor::current);
this.scriptSettings.binding(PortalRequest.class, () -> this.portalRequest);
this.scriptSettings.debug(new ScriptDebugSettings());
this.scriptSettings.globalVariable("testInstance", this);
this.executor = createExecutor();
}
Aggregations