function it_offloads_worker_persist_to_adapter(WorkerRegistryAdapterInterface $adapter, EventDispatcherInterface $eventDispatcher, WorkerInterface $worker) { $eventDispatcher->dispatch(ResqueWorkerEvents::PERSISTED, Argument::any())->shouldBeCalled(); $adapter->save($worker)->shouldBeCalled(1); $this->persist($worker)->shouldReturn($this); }
/** * {@inheritDoc} */ public function persist(WorkerInterface $worker) { $this->adapter->save($worker); $this->eventDispatcher->dispatch(ResqueWorkerEvents::PERSISTED, new WorkerEvent($worker)); return $this; }