public function testAclDelete()
 {
     // should remove 3 records
     $remove = 3;
     $created = 4;
     $total = $created + UserTests::$startAclCount;
     $acl = $this->couchdb->acl();
     $this->couchdb->acl_delete_rules(array(array('db' => 'couchdb_php_testdb1', 'role' => 'user', 'allow' => 'write')));
     $acl = $this->couchdb->acl();
     $this->assertEquals($total - $remove, count($acl->result['rules']));
     $this->couchdb->acl_delete_rules(array(array('db' => 'couchdb_php_testdb2', 'role' => 'user', 'allow' => 'write')));
     $acl = $this->couchdb->acl();
     $this->assertEquals(UserTests::$startAclCount, count($acl->result['rules']));
     if (UserTests::$resetAcl) {
         $options = array('authorization' => 'basic', 'username' => 'admin', 'password' => 'admin');
         $connection = new CouchDBConnection($options);
         $response = $connection->execute(new DeleteDocument('users', '_local/_acl', $acl->result['_rev']));
         $acl = $this->couchdb->acl();
         $this->assertNotNull($acl->error);
     }
 }
示例#2
0
 /**
  * Get version information for the current CouchDB server
  *
  * @return void
  * @author Adam Venturella
  **/
 private function _version()
 {
     static $loaded = false;
     if (!$loaded) {
         require_once 'commands/CDBVersion.php';
         $loaded = true;
     }
     $connection = new CouchDBConnection($this->connectionOptions);
     $response = $connection->execute(new CDBVersion());
     return $response->result['version'];
 }