/** * @depends testExecute */ public function testDeleteDocument() { $doc = array("_id" => "test1", "foo" => "bar"); $this->bulkUpdater->updateDocument($doc); $response = $this->bulkUpdater->execute(); $rev = $response->body[0]["rev"]; $bulkUpdater2 = $this->couchClient->createBulkUpdater(); $bulkUpdater2->deleteDocument("test1", $rev); $response = $bulkUpdater2->execute(); $response = $this->couchClient->findDocument("test1"); $this->assertEquals(404, $response->status); }
/** * @return array * @throws HTTPException * @throws \Exception */ public function getReplicationLog() { $sourceLog = null; $targetLog = null; $replicationDocId = '_local' . '/' . $this->task->getRepId(); $sourceResponse = $this->source->findDocument($replicationDocId); $targetResponse = $this->target->findDocument($replicationDocId); if ($sourceResponse->status == 200) { $sourceLog = $sourceResponse->body; } elseif ($sourceResponse->status != 404) { throw HTTPException::fromResponse('/' . $this->source->getDatabase() . '/' . $replicationDocId, $sourceResponse); } if ($targetResponse->status == 200) { $targetLog = $targetResponse->body; } elseif ($targetResponse->status != 404) { throw HTTPException::fromResponse('/' . $this->target->getDatabase() . '/' . $replicationDocId, $targetResponse); } return array($sourceLog, $targetLog); }
/** * {@inheritDoc} */ public function find($storageName, $key) { $key = $this->flattenKey($storageName, $key); return $this->client->findDocument($key); }