/** * @covers Paradox\Toolbox::setDatabase */ public function testSetDatabase() { //First we need to create a ReflectionClass object //passing in the class name as a variable $reflectionClass = new \ReflectionClass('Paradox\\Toolbox'); //Then we need to get the property we wish to test //and make it accessible $databaseProperty = $reflectionClass->getProperty('_database'); $databaseProperty->setAccessible(true); $debugger = new Debug(); $formatter = new DefaultModelFormatter(); $toolbox = new Toolbox($this->getDefaultEndpoint(), array('username' => $this->getDefaultUsername(), 'password' => $this->getDefaultPassword(), 'graph' => 'mygraph'), $debugger, $formatter); $toolbox->setDatabase('testdatabase'); $this->assertEquals('testdatabase', $databaseProperty->getValue($toolbox), "The database was not changed after setting it."); $connection = $toolbox->getConnection(); $this->assertEquals('testdatabase', $connection->getDatabase(), 'The connection triagens\\ArangoDb\\Connection object did not have the correct database selected.'); }