/** * Testing Example 5 * * @return void */ public function testExample5() { $message = new Messages(); $message->gremlin = 'g.V()'; $message->op = 'eval'; $message->processor = ''; $message->setArguments(['language' => 'gremlin-groovy']); $message->registerSerializer('\\brightzone\\rexpro\\serializers\\Json'); $db = new Connection(); $db->open(); $result = $db->send($message); //do something with result $db->close(); }
/** * Testing Script run with bindings * * @return void */ public function testRunScriptWithBindingsInSession() { $db = new Connection(); $message = $db->open('localhost:8182', 'graph', $this->username, $this->password); $this->assertNotEquals($message, FALSE); $db->message->gremlin = 'g.V(CUSTO_BIND)'; $db->message->bindValue('CUSTO_BIND', 2); $result = $db->send(NULL, 'session', 'eval'); $this->assertNotEquals($result, [], 'Running a script with bindings produced an error'); $db->message->gremlin = 'g.V(CUSTO_BIND)'; $result = $db->send(NULL, 'session', 'eval'); $this->assertNotEquals($result, [], 'Running a script with bindings produced an error'); //check disconnection $message = $db->close(); $this->assertNotEquals($message, FALSE, 'Disconnecting from a session where bindings were used created an error'); }
/** * Testing failing message connection close() * * @return void */ public function testConnectCloseFailingMessage() { $db = new Connection(); $db->open('localhost', 'tinkergraph', $this->username, $this->password); $db->sessionUuid = ''; $result = $db->close(); $this->assertFalse($result, 'Failed to return false with no transaction started'); }