diff --git a/src/Adapter/Driver/Pgsql/Connection.php b/src/Adapter/Driver/Pgsql/Connection.php index 82e6776c2c..77630bc022 100644 --- a/src/Adapter/Driver/Pgsql/Connection.php +++ b/src/Adapter/Driver/Pgsql/Connection.php @@ -123,7 +123,9 @@ public function connect() $connection = $this->getConnectionString(); set_error_handler(function ($number, $string) { throw new Exception\RuntimeException( - __METHOD__ . ': Unable to connect to database', null, new Exception\ErrorException($string, $number) + __METHOD__ . ': Unable to connect to database', + null, + new Exception\ErrorException($string, $number) ); }); $this->resource = pg_connect($connection); diff --git a/test/Adapter/Driver/Pgsql/ConnectionTest.php b/test/Adapter/Driver/Pgsql/ConnectionTest.php index 5b96345fbd..0f948cf41a 100644 --- a/test/Adapter/Driver/Pgsql/ConnectionTest.php +++ b/test/Adapter/Driver/Pgsql/ConnectionTest.php @@ -114,6 +114,9 @@ public function testSetConnectionType() $this->assertEquals($type, self::readAttribute($this->connection, 'type')); } + /** + * @runInSeparateProcess + */ public function testSetCharset() { if (! extension_loaded('pgsql')) { @@ -130,11 +133,18 @@ public function testSetCharset() 'charset' => 'SQL_ASCII', ]); - $this->connection->connect(); + try { + $this->connection->connect(); + } catch (AdapterException\RuntimeException $e) { + $this->markTestSkipped('Skipping pgsql charset test due to inability to connecto to database'); + } $this->assertEquals('SQL_ASCII', pg_client_encoding($this->connection->getResource())); } + /** + * @runInSeparateProcess + */ public function testSetInvalidCharset() { if (! extension_loaded('pgsql')) {