/** * Registers the given <code>resource</code>. When a Saga is created, all resources are injected on that instance * before any Events are passed onto it. * <p/> * Note that a CommandBus, EventBus and EventScheduler are already registered as resources, and need not be * registered again. * <p/> * Also note that you might need to reset the resources manually if you want to isolate behavior during the "when" * stage of the test. * * @param string $id resource identifier * @param mixed $resource the resource to register. */ public function registerResource($id, $resource) { $this->registeredResources[$id] = $resource; $this->fixtureParameterResolverFactory->registerService($id, $resource); }
public function registerInjectableResource($id, $resource) { if ($this->explicitCommandHandlersSet) { throw new FixtureExecutionException("Cannot inject resources after command handler has been created. " . "Configure all resource before calling " . "registerCommandHandler() or " . "registerAnnotatedCommandHandler()"); } $this->parameterResolver->registerService($id, $resource); return $this; }