/** * */ 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); }
/** * Test if we can get all collections */ public function testGetCollectionsExcludeSystem() { $collection = new Collection($this->client); /** @var $responseObject HttpResponse */ $responseObject = $collection->getAll(['excludeSystem' => true]); $response = json_decode($responseObject->body); $foundGraphs = false; foreach ($response->result as $value) { if ($value->name === '_graphs') { $foundGraphs = true; } } $this->assertFalse($foundGraphs); }
/** * */ 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); }