/** * @group public */ public function testAcl() { $store = $this->objectStore(); $cname = self::$settings['hpcloud.swift.container'] . 'PUBLIC'; if ($store->hasContainer($cname)) { $store->deleteContainer($cname); } $store->createContainer($cname, ACL::makePublic()); $store->containers(); $container = $store->container($cname); $acl = $container->acl(); $this->assertInstanceOf('\\HPCloud\\Storage\\ObjectStorage\\ACL', $acl); $this->assertTrue($acl->isPublic()); $store->deleteContainer($cname); }
public function testIsPublic() { $acl = new ACL(); $this->assertFalse($acl->isPublic()); $acl->allowListings(); $acl->addReferrer(ACL::READ, '*'); $this->assertTrue($acl->isPublic()); $acl->addAccount(ACL::WRITE, 'foo', 'bar'); $this->assertTrue($acl->isPublic()); $acl = ACL::makePublic(); $this->assertTrue($acl->isPublic()); }
/** * @depends testCreateContainerPublic */ public function testChangeContainerACL() { $testCollection = self::$settings['hpcloud.swift.container'] . 'PUBLIC'; $store = $this->objectStore(); if ($store->hasContainer($testCollection)) { $store->deleteContainer($testCollection); } $ret = $store->createContainer($testCollection); $acl = \HPCloud\Storage\ObjectStorage\ACL::makePublic(); $ret = $store->changeContainerACL($testCollection, $acl); $this->assertFalse($ret); $container = $store->container($testCollection); $url = $container->url() . '?format=xml'; $data = file_get_contents($url); $this->assertNotEmpty($data, $url); $store->deleteContainer($testCollection); }