/** * Creates CopyBlobResult object from the response of the copy blob request. * * @param array $headers The HTTP response headers in array representation. * * @return CopyBlobResult */ public static function create($headers) { $result = new CopyBlobResult(); $result->setETag(Utilities::tryGetValueInsensitive(Resources::ETAG, $headers)); if (Utilities::arrayKeyExistsInsensitive(Resources::LAST_MODIFIED, $headers)) { $lastModified = Utilities::tryGetValueInsensitive(Resources::LAST_MODIFIED, $headers); $result->setLastModified(Utilities::rfc1123ToDateTime($lastModified)); } return $result; }
/** * @covers MicrosoftAzure\Storage\Common\Internal\Utilities::inArrayInsensitive */ public function testArrayKeyExistsInsensitive() { // Setup $key = 'CaseInsensitiVe'; $array = array('caSeinSenSitivE' => '123'); // Test $actual = Utilities::arrayKeyExistsInsensitive($key, $array); // Assert $this->assertTrue($actual); }
/** * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobProperties * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setBlobMetadata */ public function testSetBlobMetadataWorks() { // Act $container = self::$_test_container_for_blobs; $blob = 'test11'; $metadata = array('test' => 'bar', 'blah' => 'bleah'); $this->restProxy->createPageBlob($container, $blob, 4096); $result = $this->restProxy->setBlobMetadata($container, $blob, $metadata); $props = $this->restProxy->getBlobProperties($container, $blob); // Assert $this->assertNotNull($result, '$result'); $this->assertNotNull($result->getETag(), '$result->getETag()'); $this->assertNotNull($result->getLastModified(), '$result->getLastModified()'); $this->assertNotNull($props, '$props'); $this->assertNotNull($props->getMetadata(), '$props->getMetadata()'); $this->assertEquals(2, count($props->getMetadata()), 'count($props->getMetadata())'); $this->assertTrue(Utilities::arrayKeyExistsInsensitive('test', $props->getMetadata()), 'Utilities::arrayKeyExistsInsensitive(\'test\', $props->getMetadata())'); $this->assertTrue(!(array_search('bar', $props->getMetadata()) === FALSE), '!(array_search(\'bar\', $props->getMetadata()) === FALSE)'); $this->assertTrue(Utilities::arrayKeyExistsInsensitive('blah', $props->getMetadata()), 'Utilities::arrayKeyExistsInsensitive(\'blah\', $props->getMetadata())'); $this->assertTrue(!(array_search('bleah', $props->getMetadata()) === FALSE), '!(array_search(\'bleah\', $props->getMetadata()) === FALSE)'); }