Doctrine\OrientDB\Binding\HttpBinding::setAdapter PHP Méthode

setAdapter() public méthode

public setAdapter ( Doctrine\OrientDB\Binding\Adapter\HttpClientAdapterInterface $adapter )
$adapter Doctrine\OrientDB\Binding\Adapter\HttpClientAdapterInterface
    public function setAdapter(HttpClientAdapterInterface $adapter)
    {
        $this->adapter = $adapter;
    }

Usage Example

 public function testOptionalDatabaseArgumentDoesNotSwitchCurrentDatabase()
 {
     $host = TEST_ODB_HOST;
     $port = TEST_ODB_PORT;
     $database = TEST_ODB_DATABASE;
     $adapter = $this->getMock('Doctrine\\OrientDB\\Binding\\Adapter\\HttpClientAdapterInterface');
     $adapter->expects($this->at(0))->method('request')->with('POST', "http://{$host}:{$port}/command/{$database}/sql/SELECT%201", null, null);
     $adapter->expects($this->at(1))->method('request')->with('POST', "http://{$host}:{$port}/command/HIJACKED/sql/SELECT%202", null, null);
     $adapter->expects($this->at(2))->method('request')->with('POST', "http://{$host}:{$port}/command/{$database}/sql/SELECT%203", null, null);
     $parameters = new BindingParameters(TEST_ODB_HOST, TEST_ODB_PORT, TEST_ODB_USER, TEST_ODB_PASSWORD, TEST_ODB_DATABASE);
     $binding = new HttpBinding($parameters);
     $binding->setAdapter($adapter);
     $binding->command('SELECT 1');
     $binding->command('SELECT 2', HttpBinding::LANGUAGE_SQLPLUS, "HIJACKED");
     $binding->command('SELECT 3');
 }