예제 #1
0
 /**
  * @covers WindowsAzure\ServiceBus\Models\QueueInfo::__construct
  */
 public function testQueueInfoConstructor()
 {
     // Setup
     $expected = 'testQueueName';
     // Test
     $queueInfo = new QueueInfo($expected);
     $actual = $queueInfo->getTitle();
     // Assert
     $this->assertNotNull($queueInfo);
     $this->assertEquals($expected, $actual);
 }
 /**
  * Creates a queue with a specified queue information. 
  * 
  * @link http://msdn.microsoft.com/en-us/library/windowsazure/hh780716
  *
  * @param QueueInfo $queueInfo The information of the queue.
  *
  * @return QueueInfo
  */
 public function createQueue($queueInfo)
 {
     $httpCallContext = new HttpCallContext();
     $httpCallContext->setMethod(Resources::HTTP_PUT);
     $httpCallContext->setPath($queueInfo->getTitle());
     $httpCallContext->addHeader(Resources::CONTENT_TYPE, Resources::ATOM_ENTRY_CONTENT_TYPE);
     $httpCallContext->addStatusCode(Resources::STATUS_CREATED);
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $queueInfo->writeXml($xmlWriter);
     $body = $xmlWriter->outputMemory();
     $httpCallContext->setBody($body);
     $response = $this->sendContext($httpCallContext);
     $queueInfo = new QueueInfo();
     $queueInfo->parseXml($response->getBody());
     return $queueInfo;
 }