/** * @covers MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions::addMetadata */ public function testAddMetadata() { // Setup $container = new CreateContainerOptions(); $key = 'key1'; $value = 'value1'; $expected = array($key => $value); // Test $container->addMetadata($key, $value); // Assert $this->assertEquals($expected, $container->getMetadata()); }
/** * Creates a new container in the given storage account. * * @param string $container The container name. * @param Models\CreateContainerOptions $options The optional parameters. * * @return none * * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179468.aspx */ public function createContainer($container, $options = null) { Validate::isString($container, 'container'); Validate::notNullOrEmpty($container, 'container'); $method = Resources::HTTP_PUT; $headers = array(); $postParams = array(); $queryParams = array(Resources::QP_REST_TYPE => 'container'); $path = $container; $statusCode = Resources::STATUS_CREATED; if (is_null($options)) { $options = new CreateContainerOptions(); } $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout()); $metadata = $options->getMetadata(); $headers = $this->generateMetadataHeaders($metadata); $this->addOptionalHeader($headers, Resources::X_MS_BLOB_PUBLIC_ACCESS, $options->getPublicAccess()); $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode); }