Ejemplo n.º 1
0
 /**
  * Get an item from the storage service.
  *
  * @param  string $path
  * @param  array $options
  * @return mixed
  */
 public function fetchItem($path, $options = null)
 {
     $item = $this->_rackspace->getObject($this->_container, $path, $options);
     if (!$this->_rackspace->isSuccessful() && $this->_rackspace->getErrorCode() != '404') {
         throw new Zend_Cloud_StorageService_Exception('Error on fetch: ' . $this->_rackspace->getErrorMsg());
     }
     if (!empty($item)) {
         return $item->getContent();
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
 /**
  * Test the authentication error (401 Unauthorized - Bad username or password)
  *
  * @return void
  */
 public function testAuthenticateError()
 {
     $this->_files->getHttpClient()->setAdapter($this->_httpClientAdapterTest);
     $this->_httpClientAdapterTest->setResponse($this->_loadResponse(__FUNCTION__));
     $this->assertFalse($this->_files->authenticate());
     $this->assertFalse($this->_files->isSuccessful());
     $this->assertEquals($this->_files->getErrorCode(), '401');
     $this->assertEquals($this->_files->getErrorMsg(), 'Bad username or password');
 }