コード例 #1
0
ファイル: RexsterTest.php プロジェクト: atomicjets/rexpro-php
 /**
  * Testing Script run without isolation
  * 
  * @return void
  */
 public function testRunScriptWithoutIsolation()
 {
     $db = new Connection();
     $message = $db->open('localhost:8184', 'tinkergraph', $this->username, $this->password);
     $this->assertNotEquals($message, FALSE);
     $db->script = 'g.v(CUSTO_BINDING)';
     $db->bindValue('CUSTO_BINDING', 2);
     $result = $db->runScript(TRUE, FALSE);
     $this->assertNotEquals($result, FALSE, 'There was an error when running a script with bindings in non-isolated mode');
     $this->assertTRUE($db->response[2] == 5, 'Script response message is not the right type. (Maybe it\'s an error)');
     //check it's a session script reply
     $db->script = 'g.v(CUSTO_BINDING)';
     $result = $db->runScript(TRUE, FALSE);
     // would return an error if isolate was TRUE
     $this->assertNotEquals($result, FALSE, 'Script created an error when using bindings that were set in a previous script call in non-isolation mode');
     $this->assertTRUE($db->response[2] == 5, 'Script response message is not the right type. (Maybe it\'s an error)');
     //check it's a session script reply
     /*$db->script = 'g.v(CUSTO_BINDING)';
     		$result = $db->runScript(); // would return an error if isolate was TRUE
     		print_r($result);
     		$this->assertEquals($result,FALSE,'No error occured when trying to use a binding from a previous message in isolated mode' );
     		$this->assertTRUE($db->response[2] == 5,'Script response message is not the right type. (Maybe it\'s an error)');//check it's a session script reply
     		*/
     //check disconnection
     $message = $db->close();
     $this->assertNotEquals($message, FALSE, 'Disconnecting from a session where bindings were used in consequent non-isolated scripts created an error');
     $this->assertTRUE($db->response[2] == 2, 'Response packet for closing session with bindings used in consequent non-isolated scripts is not the proper type. (Maybe it\'s an error)');
     //check it's a session stop server packet
 }