Пример #1
0
 /**
  * Testing Script run against DB
  * Sessions and transactions are linked ATM
  *
  * @return void
  */
 public function testRunScriptSession()
 {
     $db = new Connection();
     $message = $db->open('localhost:8182', 'graph', $this->username, $this->password);
     $this->assertNotEquals($message, FALSE, 'Failed to connect to db');
     $result = $db->send('5+5', 'session', 'eval');
     $this->assertEquals($result[0], 10, 'Script response message is not the right type. (Maybe it\'s an error)');
     //check it's a session script reply
     $result = $db->send('g.V()', 'session', 'eval');
     $this->assertEquals(count($result), 6, 'Script response message is not the right type. (Maybe it\'s an error)');
     //check it's a session script reply
     //check disconnection
     $db->close();
     $this->assertFALSE($db->isConnected(), 'Despite not throwing errors, Socket connection is not established');
     $this->assertFALSE($db->inTransaction(), 'Despite closing, transaction not closed');
 }