/**
  * Test if we can get the server version
  */
 public function testCreateReplaceDocumentAndDeleteDocumentInExistingCollection()
 {
     $collectionName = 'ArangoDB-PHP-Core-CollectionTestSuite-Collection';
     $requestBody = ['name' => 'Frank', 'bike' => 'vfr', '_key' => '1'];
     $document = new Document($this->client);
     /** @var HttpResponse $responseObject */
     $responseObject = $document->create($collectionName, $requestBody);
     $responseBody = $responseObject->body;
     $decodedJsonBody = json_decode($responseBody, true);
     static::assertArrayNotHasKey('error', $decodedJsonBody);
     static::assertEquals($collectionName . '/1', $decodedJsonBody['_id']);
     $requestBody = ['name' => 'Mike'];
     $document = new Document($this->client);
     $responseObject = $document->replace($collectionName . '/1', $requestBody);
     $responseBody = $responseObject->body;
     $decodedJsonBody = json_decode($responseBody, true);
     static::assertArrayNotHasKey('error', $decodedJsonBody);
     static::assertEquals($collectionName . '/1', $decodedJsonBody['_id']);
     $document = new Document($this->client);
     $responseObject = $document->get($collectionName . '/1', $requestBody);
     $responseBody = $responseObject->body;
     static::assertArrayNotHasKey('bike', json_decode($responseBody, true));
     $decodedJsonBody = json_decode($responseBody, true);
     static::assertEquals('Mike', $decodedJsonBody['name']);
     static::assertEquals($collectionName . '/1', $decodedJsonBody['_id']);
     $responseObject = $document->delete($collectionName . '/1');
     $responseBody = $responseObject->body;
     $decodedJsonBody = json_decode($responseBody, true);
     static::assertArrayNotHasKey('error', $decodedJsonBody);
     // Try to delete a second time .. should throw an error
     $responseObject = $document->delete($collectionName . '/1');
     $responseBody = $responseObject->body;
     $decodedJsonBody = json_decode($responseBody, true);
     static::assertArrayHasKey('error', $decodedJsonBody);
     static::assertEquals(true, $decodedJsonBody['error']);
     static::assertEquals(true, $decodedJsonBody['error']);
     static::assertEquals(404, $decodedJsonBody['code']);
     static::assertEquals(1202, $decodedJsonBody['errorNum']);
 }
    /**
     *
     */
    public function testReplaceDocument()
    {
        $deleteCollectionResponse = <<<TAG
HTTP/1.1 202 Accepted
content-type: application/json; charset=utf-8
etag: "1498093392"
location: /_db/_system/_api/document/products/1497765712

{
  "error" : false,
  "_id" : "products/1497765712",
  "_rev" : "1498093392",
  "_key" : "1497765712"
}
TAG;
        $handle = 'products/1234567890';
        $body = '{ "Hello": "World" }';
        $options = ['waitForSync' => true];
        $this->connector->method('request')->willReturn($deleteCollectionResponse);
        $object = new Document($this->client);
        /** @var $responseObject HttpResponse */
        $response = $object->replace($handle, $body);
        $this->assertInstanceOf('\\frankmayer\\ArangoDbPhpCore\\Protocols\\Http\\HttpResponse', $response);
        $this->assertEquals(202, $response->status);
    }