Ejemplo n.º 1
0
 /**
  * @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);
 }
Ejemplo n.º 2
0
 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());
 }
Ejemplo n.º 3
0
 /**
  * @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);
 }