/** * {@inheritDoc} */ public function findWorkerById($workerId) { $worker = $this->workerFactory->createWorkerFromId($workerId); if ($this->adapter->has($worker)) { return $worker; } return null; }
function it_returns_null_on_finding_unregistered_workers(WorkerRegistryAdapterInterface $adapter, WorkerFactoryInterface $workerFactory, WorkerInterface $worker) { $workerFactory->createWorkerFromId('compy:55:foo')->shouldBeCalled()->willReturn($worker); $adapter->has($worker)->shouldBeCalled()->willReturn(false); $this->findWorkerById('compy:55:foo')->shouldReturn(null); }