public function testGetDocumentFromNotExistentDatabase() { $this->markTestSkipped('It is currently not possible to detect from the CouchDB response, see: https://issues.apache.org/jira/browse/COUCHDB-41'); phpillowCustomConnection::createInstance(); phpillowConnection::setDatabase('test'); $db = phpillowConnection::getInstance(); try { $response = $db->delete('/test'); } catch (phpillowResponseErrorException $e) { /* Ignore */ } try { $response = $db->get('/test/not_existent'); $this->fail('Expected phpillowDatabaseNotFoundErrorException.'); } catch (phpillowDatabaseNotFoundErrorException $e) { /* Expected exception */ } }
/** * Prime caches of all views * * Returns a proper status code indicating successful execution of the * command. * * @return int */ public function primeCaches() { if ($this->printVersion()) { return 0; } if (!$this->parseConnectionInformation()) { return 1; } // Open connection $db = new phpillowCustomConnection($this->connectionInfo['host'], $this->connectionInfo['port'], $this->connectionInfo['user'], $this->connectionInfo['pass']); $designDocs = $db->get($this->connectionInfo['path'] . '/_all_docs?startkey=%22_design%2F%22&endkey=%22_design0%22'); foreach ($designDocs->rows as $doc) { $views = $db->get($this->connectionInfo['path'] . '/' . $doc['id']); foreach ($views->views as $view => $functions) { $this->out("Priming view " . $doc['id'] . "/" . $view . "\n"); $db->get($this->connectionInfo['path'] . '/' . $doc['id'] . '/_view/' . $view); } } }
public function testInvalidPath() { phpillowCustomConnection::createInstance(); $db = phpillowConnection::getInstance(); try { $response = $db->get('irrelevant'); $this->fail('Expected phpillowInvalidRequestException.'); } catch (phpillowInvalidRequestException $e) { /* Expected exception */ } }