public function testSetServer() { $connection = new Connection($this->server, $this->dbName); $connection->setServer($server = 'mongodb://localhost:27017'); $this->assertSame($server, $connection->getServer()); $connection->getMongo(); try { $connection->setServer($this->server); $this->fail(); } catch (\Exception $e) { $this->assertInstanceOf('LogicException', $e); } }