public function testHasDocumentReturnsFalseIfDocumentDoesNotExist() { $connection = $this->connection; $collection = $this->collection; $documentHandler = new DocumentHandler($connection); $this->assertFalse($documentHandler->has($collection->getId(), 'just_a_stupid_document_id_which_does_not_exist')); }
// create another new document $user = new Document(); $user->set("name", "j-lo"); $user->level = 1; $user->vists = array(1, 2, 3); $id = $handler->save("users", $user); var_dump("CREATED A NEW DOCUMENT WITH ID: ", $id); // get this document from the server $userFromServer = $handler->getById("users", $id); var_dump($userFromServer); // update this document $userFromServer->nonsense = "hihi"; unset($userFromServer->name); $result = $handler->update($userFromServer); var_dump($result); // get the updated document back $result = $handler->get("users", $id); var_dump($result); // delete the document $result = $handler->deleteById("users", $id); var_dump($result); // check if a document exists $result = $handler->has("users", "foobar123"); var_dump($result); } catch (ConnectException $e) { print $e . PHP_EOL; } catch (ServerException $e) { print $e . PHP_EOL; } catch (ClientException $e) { print $e . PHP_EOL; }