/** * 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 Exception\RuntimeException('Error on fetch: ' . $this->rackspace->getErrorMsg()); } if (!empty($item)) { return $item->getContent(); } else { return false; } }
/** * 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'); }