/** * Create a database on a host and return it as an object * * @param string $dbname * @param string $host * @param integer $port * @return Sopha_Db */ public static function createDb($dbname, $host = 'localhost', $port = self::COUCH_PORT) { $uri = self::makeDbUrl($dbname, $host, $port); $response = Sopha_Http_Request::put($uri); switch ($response->getStatus()) { case 201: // Expected return new Sopha_Db($dbname, $host, $port); break; case 412: // DB already exists require_once 'Sopha/Db/Exception.php'; throw new Sopha_Db_Exception("Database '{$dbname}' already exists", 412); break; default: // Unexpected require_once 'Sopha/Db/Exception.php'; throw new Sopha_Db_Exception("Unexpected response from server: {$response->getStatus()}", $response->getStatus()); break; } }
/** * Tests Sopha_Http_Request::put() */ public function testPut() { // TODO Auto-generated Sopha_Http_RequestTest::testPut() $this->markTestIncomplete("put test not implemented"); Sopha_Http_Request::put(); }