ObjectAclTest.php 820 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace OSS\Tests;
  3. require_once __DIR__ . '/Common.php';
  4. class ObjectAclTest extends \PHPUnit_Framework_TestCase
  5. {
  6. public function testGetSet()
  7. {
  8. $client = Common::getOssClient();
  9. $bucket = Common::getBucketName();
  10. $object = 'test/object-acl';
  11. $client->deleteObject($bucket, $object);
  12. $client->putObject($bucket, $object, "hello world");
  13. $acl = $client->getObjectAcl($bucket, $object);
  14. $this->assertEquals('default', $acl);
  15. $client->putObjectAcl($bucket, $object, 'public-read');
  16. $acl = $client->getObjectAcl($bucket, $object);
  17. $this->assertEquals('public-read', $acl);
  18. $content = $client->getObject($bucket, $object);
  19. $this->assertEquals('hello world', $content);
  20. }
  21. }