Example #1
0
 /**
  * @covers Paradox\Client::useConnection
  */
 public function testUseConnection()
 {
     //First we need to create a ReflectionClass object
     //passing in the class name as a variable
     $reflectionClass = new \ReflectionClass('Paradox\\Client');
     //Then we need to get the property we wish to test
     //and make it accessible
     $currentConnection = $reflectionClass->getProperty('_currentConnection');
     $currentConnection->setAccessible(true);
     $this->client->addConnection('newconnection', 'tcp://someendpoint', array('username' => 'someuser', 'password' => 'somepassword', 'graph' => $this->graphName));
     $this->client->useConnection('newconnection');
     $this->assertEquals('newconnection', $currentConnection->getValue($this->client), 'The current connection should be set to "newconnection"');
 }