public function testGetNotExists() { $queue = new Queue(); $queue->setUrl('Testurl!'); $queue->setDelaySeconds(300); $queueStorage = new QueueStorage(); $this->assertNull($queueStorage->get($queue), 'Queue does not exists'); }
public function testLoadQueueAttributes() { $queue = new Queue(); $queue->setUrl('http://test.x/blub'); $queue->setDelaySeconds(123); $queue2 = new Queue(); $queue2->setUrl('http://test.x/blub'); $queue2->setDelaySeconds(51); $manager = $this->getMockBuilder('AmazonSQS\\Manager')->setConstructorArgs(array('accesskey', 'secretkey'))->setMethods(array('call'))->getMock(); $manager->expects($this->once())->method('call')->with('GetQueueAttributes', array('AttributeName.1' => 'All'), 'http://test.x/blub')->will($this->returnValue(array('Attribute' => array(array('Name' => 'DelaySeconds', 'Value' => '51'))))); $serializer = $this->getMockBuilder('Symfony\\Component\\Serializer\\Serializer')->getMock(); $serializer->expects($this->at(0))->method('normalize')->with($queue)->will($this->returnValue(array('delaySeconds' => '123'))); $serializer->expects($this->at(1))->method('denormalize')->with(array('delaySeconds' => '51'), '\\AmazonSQS\\Model\\Queue')->will($this->returnValue($queue2)); $queueStorage = $this->getMockBuilder('AmazonSQS\\Storage\\QueueStorage')->getMock(); $queueStorage->expects($this->once())->method('add')->with($queue2); $manager->setQueueStorage($queueStorage); $manager->setSerializer($serializer); $queue = $manager->loadQueueAttributes($queue); $this->assertEquals(51, $queue->getDelaySeconds(), 'Wrong queue'); }