/** * Test if we can get the server version */ public function testTruncateCollection() { $collectionName = 'ArangoDB-PHP-Core-CollectionTestSuite-Collection'; $collection = new Collection($this->client); /** @var $responseObject HttpResponse */ $responseObject = $collection->truncate($collectionName); $body = $responseObject->body; $this->assertArrayHasKey('code', json_decode($body, true)); $decodedJsonBody = json_decode($body, true); $this->assertEquals(200, $decodedJsonBody['code']); $this->assertEquals($collectionName, $decodedJsonBody['name']); }
/** * */ public function testTruncateCollection() { $deleteCollectionResponse = <<<TAG HTTP/1.1 200 OK content-type: application/json; charset=utf-8 { "id" : "1397167952", "name" : "products", "isSystem" : false, "status" : 3, "type" : 2, "error" : false, "code" : 200 } TAG; $options = ['waitForSync' => true]; $this->connector->method('request')->willReturn($deleteCollectionResponse); $object = new Collection($this->client); /** @var $responseObject HttpResponse */ $response = $object->truncate($this->collectionNames[0], $options); $this->assertInstanceOf('\\frankmayer\\ArangoDbPhpCore\\Protocols\\Http\\HttpResponse', $response); $this->assertEquals(200, $response->status); }