private function _commitBlocks($url, $blockIds)
 {
     $baseUrl = new Url($url);
     $baseUrl->setQueryVariable(Resources::QP_COMP, 'blocklist');
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement('BlockList');
     foreach ($blockIds as $blockId) {
         $xml->writeElement('Latest', $blockId);
     }
     $xml->endElement();
     $xml->endDocument();
     $xmlContent = $xml->outputMemory();
     $method = Resources::HTTP_PUT;
     $filters = array();
     $statusCode = Resources::STATUS_CREATED;
     $headers = array(Resources::CONTENT_TYPE => Resources::BINARY_FILE_TYPE, Resources::X_MS_VERSION => Resources::STORAGE_API_LATEST_VERSION);
     $httpClient = new HttpClient();
     $httpClient->setMethod($method);
     $httpClient->setHeaders($headers);
     $httpClient->setExpectedStatusCode($statusCode);
     $httpClient->setBody($xmlContent);
     $httpClient->send($filters, $baseUrl);
 }
Пример #2
0
 /**
  * @covers WindowsAzure\Common\Internal\Http\Url::__clone
  */
 public function test__clone()
 {
     // Setup
     $urlString = TestResources::VALID_URL;
     $url = new Url($urlString);
     // Test
     $actualUrl = clone $url;
     $url->setQueryVariable('key', 'value');
     // Assert
     $this->assertNotEquals($url->getQueryVariables(), $actualUrl->getQueryVariables());
 }