/** * Delete one messages from queue * * @param \AmazonSQS\Model\Message $message * * @return bool */ public function deleteMessage(Message $message) { $params = array(); $params['ReceiptHandle'] = $message->getReceiptHandle(); return $this->call('DeleteMessage', $params, $message->getQueue()->getUrl()); }
public function testDeleteMessage() { $queue = new Queue(); $queue->setUrl('http://test.x/blub'); $message = new Message(); $message->setReceiptHandle('example_receipt_handle'); $message->setQueue($queue); $manager = $this->getMockBuilder('AmazonSQS\\Manager')->setConstructorArgs(array('accesskey', 'secretkey'))->setMethods(array('call'))->getMock(); $manager->expects($this->once())->method('call')->with('DeleteMessage', array('ReceiptHandle' => 'example_receipt_handle'), 'http://test.x/blub')->will($this->returnValue(true)); $this->assertTrue($manager->deleteMessage($message), 'DeleteMessage should return false'); }