Пример #1
0
 public function testGetObjects()
 {
     $objects = $this->rackspace->getObjects(TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME);
     $this->assertTrue($objects !== false);
     $this->assertEquals($objects[0]->getName(), TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME);
     $this->assertEquals($objects[1]->getName(), TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME . '-copy');
 }
Пример #2
0
 /**
  * @group GH-68
  */
 public function testGetObjectsPseudoDirs()
 {
     $objects = $this->rackspace->getObjects('zf-unit-test', array('delimiter' => '/', 'prefix' => 'dir/'));
     $this->assertTrue($objects !== false);
     $this->assertEquals($objects[0]->getName(), 'dir/subdir1/');
     $this->assertEquals($objects[1]->getName(), 'dir/subdir2/');
 }
Пример #3
0
 public function testGetObjects()
 {
     $objects = $this->rackspace->getObjects('zf-unit-test');
     $this->assertTrue($objects !== false);
     $this->assertEquals($objects[0]->getName(), 'zf-object-test');
     $this->assertEquals($objects[1]->getName(), 'zf-object-test' . '-copy');
 }
Пример #4
0
 /**
  * Get a list of objects that starts with path prefix
  *
  * @param string $prefix
  * @return Zend_Service_Rackspace_Files_ObjectList
  */
 public function getObjectList($prefix, $container = false)
 {
     if (!$container) {
         $container = $this->getGeneralContainer();
     }
     $objectList = $this->_service->getObjects($container, array('prefix' => $prefix));
     return $objectList;
 }
 /**
  * Tears down this test case
  *
  * @return void
  */
 public function tearDown()
 {
     if (!$this->_config) {
         return;
     }
     // Delete the container here
     $rackspace = new Zend_Service_Rackspace_Files($this->_config->get(Zend_Cloud_StorageService_Adapter_Rackspace::USER), $this->_config->get(Zend_Cloud_StorageService_Adapter_Rackspace::API_KEY));
     $files = $rackspace->getObjects($this->_config->get(Zend_Cloud_StorageService_Adapter_Rackspace::REMOTE_CONTAINER));
     if ($files == !false) {
         foreach ($files as $file) {
             $rackspace->deleteObject($this->_config->get(Zend_Cloud_StorageService_Adapter_Rackspace::REMOTE_CONTAINER), $file->getName());
         }
     }
     $rackspace->deleteContainer($this->_config->get(Zend_Cloud_StorageService_Adapter_Rackspace::REMOTE_CONTAINER));
     parent::tearDown();
 }
Пример #6
0
 /**
  * Return an array of the items contained in the given path.  The items
  * returned are the files or objects that in the specified path.
  *
  * @param  string $path
  * @param  array  $options
  * @return array
  */
 public function listItems($path, $options = null)
 {
     if (!empty($path)) {
         $options = array('prefix' => $path);
     }
     $files = $this->_rackspace->getObjects($this->_container, $options);
     if (!$this->_rackspace->isSuccessful()) {
         throw new Zend_Cloud_StorageService_Exception('Error on list items: ' . $this->_rackspace->getErrorMsg());
     }
     $resultArray = array();
     if (!empty($files)) {
         foreach ($files as $file) {
             $resultArray[] = $file->getName();
         }
     }
     return $resultArray;
 }