/** * @expectedException \Stomp\Exception\StompException */ public function testWaitForReceiptWillThrowExceptionOnIdMissmatch() { $receiptFrame = new Frame('RECEIPT'); $receiptFrame->setHeader('receipt-id', 'not-matching-id'); $stomp = $this->getStompWithInjectedMockedConnectionReadResult($receiptFrame); $waitForReceipt = new ReflectionMethod($stomp, 'waitForReceipt'); $waitForReceipt->setAccessible(true); // expect a receipt for another id $waitForReceipt->invoke($stomp, 'your-id'); }
/** * Write frame to server and expect an matching receipt frame * * @param Frame $stompFrame * @return bool */ protected function sendFrameExpectingReceipt(Frame $stompFrame) { $receipt = md5(microtime()); $stompFrame->setHeader('receipt', $receipt); $this->connection->writeFrame($stompFrame); return $this->waitForReceipt($receipt); }