From: Jeremy Benoist Date: Tue, 12 Dec 2017 12:34:06 +0000 (+0100) Subject: Fix tests X-Git-Tag: 2.3.1~14^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=refs%2Fpull%2F3488%2Fhead;p=github%2Fwallabag%2Fwallabag.git Fix tests --- diff --git a/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php b/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php index b49166f2..439ae17d 100644 --- a/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php +++ b/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php @@ -18,16 +18,16 @@ class CustomPostgreSqlSchemaManager extends PostgreSqlSchemaManager */ protected function _getPortableSequenceDefinition($sequence) { + $sequenceName = $sequence['relname']; if ('public' !== $sequence['schemaname']) { $sequenceName = $sequence['schemaname'] . '.' . $sequence['relname']; - } else { - $sequenceName = $sequence['relname']; } $query = 'SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName); - // patch for PostgreSql >= 10 - if ((float) ($this->_conn->getWrappedConnection()->getServerVersion()) >= 10) { + // the `method_exists` is only to avoid test to fail: + // DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticConnection doesn't support the `getServerVersion` + if (method_exists($this->_conn->getWrappedConnection(), 'getServerVersion') && (float) ($this->_conn->getWrappedConnection()->getServerVersion()) >= 10) { $query = "SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = 'public' AND sequencename = " . $this->_conn->quote($sequenceName); }