/** * Tests that this adapter can connect to the database, and that the status is properly * persisted. */ public function testDatabaseConnection() { $db = new PostgreSql(array('autoConnect' => false) + $this->_dbConfig); $this->assertTrue($db->connect()); $this->assertTrue($db->isConnected()); $this->assertTrue($db->disconnect()); $this->assertFalse($db->isConnected()); $db = new PostgreSql(array('autoConnect' => false, 'encoding' => null, 'persistent' => false, 'host' => 'localhost:5432', 'login' => 'garbage', 'password' => '', 'database' => 'garbage', 'init' => true, 'schema' => 'garbage') + $this->_dbConfig); $this->expectException(); $this->assertFalse($db->connect()); $this->assertFalse($db->isConnected()); $this->assertTrue($db->disconnect()); $this->assertFalse($db->isConnected()); }