public function testPeekMessages() { try { $queueURL = $this->_commonQueue->createQueue('test-peek-messages'); $this->assertNotNull($queueURL); $this->_wait(); $message1 = 'testPeekMessage - Message 1'; $this->_commonQueue->sendMessage($queueURL, $message1); $this->_wait(); $peekedMessages = $this->_commonQueue->peekMessages($queueURL, 1); foreach ($peekedMessages as $message) { $this->assertEquals($message1, $message->getBody()); break; } // and again $peekedMessages = $this->_commonQueue->peekMessages($queueURL, 1); foreach ($peekedMessages as $message) { $this->assertEquals($message1, $message->getBody()); break; } $this->_commonQueue->deleteQueue($queueURL); } catch (Exception $e) { if (isset($queueURL)) { $this->_commonQueue->deleteQueue($queueURL); } throw $e; } }