/** * @test */ public function enqueues() { $this->ed->expects($this->once())->method('dispatch')->with(Events::ENQUEUE, $this->isInstanceOf('Pekkis\\Queue\\SymfonyBridge\\MessageEvent')); $message = Message::create('lus'); $this->innerqueue->expects($this->once())->method('enqueue')->with('lussogrande', array('tenhunen' => 'imaisee'))->will($this->returnValue($message)); $ret = $this->queue->enqueue('lussogrande', array('tenhunen' => 'imaisee')); $this->assertSame($message, $ret); }
/** * @param callable $callback * @param array $params * @return Message */ public function execute(callable $callback, $params = []) { if (!$this->attached) { throw new LogicException('Must be attached to a file library'); } $command = new SerializedCallback($callback, $params); return $this->queue->enqueue('xi_filelib.asynchrony.command', $command); }