/** * Return one queue by url * * @param string $url Queue url * @param bool $loadAttributes (Optional) Load queue attributes - Default: true * * @return \AmazonSQS\Model\Queue */ public function getQueueByUrl($url, $loadAttributes = true) { $queue = new Queue(); $queue->setName(substr($url, strrpos($url, '/') + 1)); $queue->setUrl($url); if ($loadAttributes) { $queue = $this->loadQueueAttributes($queue); } return $queue; }
public function testCreateQueueWithAttributes() { $queue = new Queue(); $queue->setName('testqueuename'); $queue->setDelaySeconds(100); $manager = $this->getMockBuilder('AmazonSQS\\Manager')->setConstructorArgs(array('accesskey', 'secretkey'))->setMethods(array('call'))->getMock(); $manager->expects($this->once())->method('call')->with('CreateQueue', array('QueueName' => 'testqueuename', 'Attribute.1.Name' => 'DelaySeconds', 'Attribute.1.Value' => 100))->will($this->returnValue(array('QueueUrl' => 'url1'))); $queue2 = $manager->createQueue($queue); $this->assertEquals('url1', $queue2->getUrl(), 'Wrong queue url'); }