public function testExecute() { $message = $this->createAmqpMessageMock(); $message->body = $body = '{"foo":"bar"}'; $this->serializer->expects($this->once())->method('deserialize')->with($this->identicalTo($body))->will($this->returnValue($process = $this->createProcessMock())); $this->runner->expects($this->once())->method('run')->with($this->identicalTo($process)); $this->consumer->execute($message); }
public function testRunError() { $process = $this->createProcessMock(); $process->expects($this->once())->method('getCommandLine')->will($this->returnValue($command = 'foo.sh')); $this->logger->expects($this->once())->method('debug')->with($this->identicalTo(sprintf('Webhook process started: "%s".', $command))); $process->expects($this->once())->method('run'); $process->expects($this->once())->method('isSuccessful')->will($this->returnValue(false)); $process->expects($this->once())->method('getOutput')->will($this->returnValue($output = 'output')); $process->expects($this->once())->method('getErrorOutput')->will($this->returnValue($error = 'error')); $this->logger->expects($this->once())->method('error')->with($this->identicalTo(sprintf('Webhook process errored: "%s".', $command)), $this->identicalTo(['output' => $output, 'error' => $error])); $this->runner->run($process); }
/** * {@inheritdoc} */ public function execute(AMQPMessage $message) { $this->processRunner->run($this->processSerializer->deserialize($message->body)); }