/** * @covers WindowsAzure\Blob\BlobRestProxy::createBlockBlob * @covers WindowsAzure\Blob\BlobRestProxy::createContainer * @covers WindowsAzure\Blob\BlobRestProxy::deleteContainer * @covers WindowsAzure\Blob\BlobRestProxy::getContainerACL * @covers WindowsAzure\Blob\BlobRestProxy::setContainerACL */ private function setContainerACLWorker($options, $acl) { $container = BlobServiceFunctionalTestData::getInterestingContainerName(); // Make sure there is something to test $this->restProxy->createContainer($container); $blobContent = uniqid(); try { $this->restProxy->createBlockBlob($container, 'test', $blobContent); } catch (UnsupportedEncodingException $e1) { // UTF-8 should be fine. error_log($e1->getMessage()); } try { if (is_null($options)) { $this->restProxy->setContainerACL($container, $acl); $this->restProxy->setContainerACL($container, $acl); } else { $this->restProxy->setContainerACL($container, $acl, $options); $this->restProxy->setContainerACL($container, $acl, $options); } if (is_null($options)) { $options = new BlobServiceOptions(); } if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) { $this->assertTrue(false, 'Expect negative timeouts in $options to throw'); } $res = $this->restProxy->getContainerACL($container); $this->verifySetContainerACLWorker($res, $container, $acl, $blobContent); } catch (ServiceException $e) { if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) { $this->assertEquals(500, $e->getCode(), 'getCode'); } else { throw $e; } } // Clean up. $this->restProxy->deleteContainer($container); }
/** * @covers WindowsAzure\Blob\BlobRestProxy::createBlockBlob * @covers WindowsAzure\Blob\BlobRestProxy::createContainer * @covers WindowsAzure\Blob\BlobRestProxy::deleteContainer * @covers WindowsAzure\Blob\BlobRestProxy::getContainerACL * @covers WindowsAzure\Blob\BlobRestProxy::setContainerACL */ private function setContainerACLWorker($options, $acl) { $container = BlobServiceFunctionalTestData::getInterestingContainerName(); // Make sure there is something to test $this->restProxy->createContainer($container); $blobContent = uniqid(); $this->restProxy->createBlockBlob($container, 'test', $blobContent); try { if (is_null($options)) { $this->restProxy->setContainerACL($container, $acl); $this->restProxy->setContainerACL($container, $acl); } else { $this->restProxy->setContainerACL($container, $acl, $options); $this->restProxy->setContainerACL($container, $acl, $options); } if (is_null($options)) { $options = new BlobServiceOptions(); } if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) { $this->assertTrue(false, 'Expect negative timeouts in $options to throw'); } $res = $this->restProxy->getContainerACL($container); $this->verifySetContainerACLWorker($res, $container, $acl, $blobContent); } catch (ServiceException $e) { if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) { $this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'getCode'); } else { throw $e; } } // Clean up. $this->restProxy->deleteContainer($container); }