public function testGetObjectUrl()
 {
     $container = new Container('foo');
     $container->setPublic();
     $url = 'http://swift.example.org/container/object';
     $object = new SwiftObject($container, 'bar');
     $this->driver->expects($this->once())->method('getObjectUrl')->with($object)->willReturn($url);
     $this->assertEquals($url, $this->store->getObjectUrl($object));
 }
예제 #2
0
 public function testPublicPrivate()
 {
     $container = new Container('foo');
     $this->assertTrue($container->isPrivate(), 'New containers are private by default');
     $this->assertFalse($container->isPublic());
     $container->setPublic();
     $this->assertTrue($container->isPublic());
     $this->assertFalse($container->isPrivate());
     $container->setPrivate();
     $this->assertTrue($container->isPrivate());
     $this->assertFalse($container->isPublic());
 }
예제 #3
0
 /**
  * Create a container.
  *
  * @param string $name
  * @param bool   $private
  *
  * @throws SwiftException
  *
  * @return Container
  *
  * @see DriverInterface::createContainer()
  */
 public function createContainer($name, $private = true)
 {
     if (false === isset($this->containers[$name])) {
         $container = new Container($name);
         $private ? $container->setPrivate() : $container->setPublic();
         if (!$this->driver->createContainer($container)) {
             throw new SwiftException(sprintf('Could not create container %s', $name));
         }
         $this->containers[$name] = $container;
     }
     return $this->containers[$name];
 }
 public function testUpdateContainer()
 {
     $name = 'foo';
     $container = new Container($name);
     $container->setPublic();
     $this->mockClientRequest('post', $name, ['X-Container-Meta-Read' => '.r:*'], null, new Response(204));
     $this->assertTrue($this->driver->updateContainer($container));
 }