public function testMissingRequestReturnNull() { $this->socket->expects($this->once())->method('send')->with(TaskManager::MESSAGE_PROCESS_UPDATE); $this->socket->expects($this->once())->method('recv')->will($this->returnValue(json_encode(['request' => TaskManager::MESSAGE_PROCESS_UPDATE]))); $this->setExpectedException(RuntimeException::class, 'Invalid task manager response : missing fields.'); $this->sut->notify(Notifier::MESSAGE_CREATE); }
private function notify($message) { try { $this->notifier->notify($message); } catch (RuntimeException $e) { } }
public function testMissingRequestReturnNull() { $socket = $this->createSocketMock(); $socket->expects($this->once())->method('send')->with(TaskManager::MESSAGE_PROCESS_UPDATE); $socket->expects($this->once())->method('recv')->will($this->returnValue(json_encode(['request' => TaskManager::MESSAGE_PROCESS_UPDATE]))); $notifier = new Notifier($socket, $this->getMock('Psr\\Log\\LoggerInterface')); $this->setExpectedException('Alchemy\\Phrasea\\Exception\\RuntimeException', 'Invalid task manager response : missing fields.'); $notifier->notify(Notifier::MESSAGE_CREATE); }