/** * */ public function testRegisterPluginsWithDifferentPrioritiesTestAndUnRegisterPlugin() { $this->client->setPluginManager(new PluginManager($this->client)); static::assertInstanceOf('\\frankmayer\\ArangoDbPhpCore\\Plugins\\PluginManager', $this->client->getPluginManager()); $tracer = new TestPlugin(); $tracer->priority = 0; $tracer2 = new TestPlugin(); $tracer2->priority = 20; $tracer3 = new TestPlugin(); $tracer3->priority = -30; $tracer4 = new TestPlugin(); $tracer4->priority = 20; $this->clientOptions['plugins'] = ['tracer1' => $tracer, 'tracer2' => $tracer2, 'tracer3' => $tracer3, 'tracer4' => $tracer4]; $this->client->setPluginsFromPluginArray($this->clientOptions['plugins']); static::assertArrayHasKey('tracer3', $this->client->pluginManager->pluginStorage); $e = null; try { $this->client->setPluginsFromPluginArray(['tracer5' => new \stdClass()]); } catch (\Exception $e) { } static::assertInstanceOf('\\Exception', $e); /** @var $responseObject HttpResponse */ $collection = new Collection($this->client); /** @var $responseObject HttpResponse */ $responseObject = $collection->getAll(); static::assertInstanceOf('frankmayer\\ArangoDbPhpCore\\Protocols\\Http\\HttpRequestInterface', $responseObject->request); }
/** * */ public function tearDown() { $collectionName = 'ArangoDB-PHP-Core-CollectionTestSuite-Collection'; $collection = new Collection($this->client); /** @var $responseObject HttpResponse */ $collection->drop($collectionName); }
/** * */ public function tearDown() { $batchParts = []; foreach ($this->collectionNames as $collectionName) { $collection = new Collection($this->client); /** @var $responseObject HttpResponse */ $batchParts[] = $collection->drop($collectionName, ['isBatchPart' => true]); } $batch = new Batch($this->client); $batch->send($this->client, $batchParts); }
/** * @throws ClientException */ public function tearDown() { $collectionName = 'ArangoDB-PHP-Core-CollectionTestSuite-Collection'; $collectionOptions = ["waitForSync" => true]; $options = $collectionOptions; $this->client->bind('Request', function () { $request = $this->client->getRequest(); return $request; }); $request = $this->client->make('Request'); $request->options = $options; $request->path = $this->client->fullDatabasePath . self::API_COLLECTION . '/' . $collectionName; $request->method = self::METHOD_DELETE; /** @var HttpResponse $responseObject */ $responseObject = $request->send(); $body = $responseObject->body; $this->assertArrayHasKey('code', json_decode($body, true)); $decodedJsonBody = json_decode($body, true); $this->assertEquals(200, $decodedJsonBody['code']); $collectionName = 'ArangoDB-PHP-Core-CollectionTestSuite-NonExistingCollection'; $collection = new Collection($this->client); /** @var $responseObject HttpResponse */ $collection->drop($collectionName); }
/** * */ public function tearDown() { $batchParts = []; foreach ($this->collectionNames as $collectionName) { $collection = new Collection($this->client); /** @var $responseObject HttpResponse */ $batchParts[] = $collection->drop($collectionName, ['isBatchPart' => true]); } $responseObject = Batch::send($this->client, $batchParts); static::assertEquals(200, $responseObject->status); }
/** * */ public function testBuildBatchResponseAndSplitHeadersAndBodies() { $collectionOptions = ['waitForSync' => true]; $batchRequests = []; foreach ($this->collectionNames as $collectionName) { $collection = new Collection($this->client); /** @var $responseObject HttpResponse */ $batchRequest = $collection->create($collectionName, $collectionOptions, ['isBatchPart' => true]); // $this->assertEquals(202, $batchRequest->status); $batchRequests[] = $batchRequest; } $this->batch = new Batch($this->client); $batchResponse = $this->batch->send($this->client, $batchRequests); // check that contentId property return correct value foreach ($batchResponse->batch as $key => $batchPartResponseObject) { $this->assertEquals($key + 1, $batchPartResponseObject->batchContentId); } }
/** * */ public function testGetAllCollection() { $deleteCollectionResponse = <<<TAG HTTP/1.1 200 OK content-type: application/json; charset=utf-8 { "collections" : [ { "id" : "5707600", "name" : "_configuration", "isSystem" : true, "status" : 3, "type" : 2 }, { "id" : "1001854800", "name" : "Groceries", "isSystem" : false, "status" : 3, "type" : 2 } } TAG; $options = ['excludeSystem' => true]; $this->connector->method('request')->willReturn($deleteCollectionResponse); $object = new Collection($this->client); /** @var $responseObject HttpResponse */ $response = $object->getAll($options); $this->assertInstanceOf('\\frankmayer\\ArangoDbPhpCore\\Protocols\\Http\\HttpResponse', $response); $this->assertEquals(200, $response->status); }