Skip to content

Commit

Permalink
Fix unit tests for PostgreSQL 10 (#21370)
Browse files Browse the repository at this point in the history
  • Loading branch information
csthomas authored and ReLater committed Sep 1, 2018
1 parent f5027d4 commit 052d5f0
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,18 +411,30 @@ public function testGetTableSequences()
$seq->schema = 'public';
$seq->table = 'jos_dbtest';
$seq->column = 'id';
$seq->data_type = 'bigint';

if (version_compare(self::$driver->getVersion(), '9.1.0') >= 0)
$version = self::$driver->getVersion();

if (version_compare($version, '9.1.0') >= 0)
{
$seq->start_value = '1';
$seq->minimum_value = '1';
$seq->maximum_value = '9223372036854775807';
$seq->increment = '1';
$seq->cycle_option = 'NO';

if (version_compare($version, '10') >= 0)
{
$seq->data_type = 'integer';
$seq->maximum_value = '2147483647';
}
else
{
$seq->data_type = 'bigint';
$seq->maximum_value = '9223372036854775807';
}
}
else
{
$seq->data_type = 'bigint';
$seq->minimum_value = null;
$seq->maximum_value = null;
$seq->increment = null;
Expand Down Expand Up @@ -500,7 +512,7 @@ public function testGetTableList()
public function testGetVersion()
{
$versionRow = self::$driver->setQuery('SELECT version();')->loadRow();
preg_match('/((\d+)\.)((\d+)\.)(\*|\d+)/', $versionRow[0], $versionArray);
preg_match('/\d+(?:\.\d+)+/', $versionRow[0], $versionArray);

$this->assertGreaterThanOrEqual($versionArray[0], self::$driver->getVersion());
}
Expand Down

0 comments on commit 052d5f0

Please sign in to comment.