Skip to content

Commit 4358675

Browse files
authored
Merge pull request #269 from nextras/dbs
New db versions to test
2 parents d2e107a + 65b9ac9 commit 4358675

10 files changed

+84
-54
lines changed

.github/renovate.json5

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
44
"config:recommended",
5+
"schedule:earlyMondays"
56
],
67
}

.github/workflows/build.yml

+29-19
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- v*.*
1313

1414
env:
15-
php-extensions: mbstring, intl, mysqli, pgsql, sqlsrv-5.10.0-beta1, pdo_sqlsrv-5.10.0-beta1
15+
php-extensions: mbstring, intl, mysqli, pgsql, sqlsrv, pdo_sqlsrv
1616
php-extensions-key: v1
1717
php-tools: "composer:v2, pecl"
1818

@@ -63,37 +63,45 @@ jobs:
6363
runs-on: ubuntu-latest
6464

6565
services:
66-
mysql57:
67-
image: mysql:5.7
66+
# MySQL LTS versions tested (https://endoflife.date/mysql)
67+
mysql80:
68+
image: mysql:8.0
69+
ports:
70+
- 3306:3306
71+
options: --health-cmd="mysqladmin ping -ppass" --health-interval=10s --health-timeout=5s --health-retries=5 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=nextras_dbal_test --entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --mysql-native-password=ON"
72+
mysql84:
73+
image: mysql:8.4
74+
ports:
75+
- 3307:3306
76+
options: --health-cmd="mysqladmin ping -ppass" --health-interval=10s --health-timeout=5s --health-retries=5 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=nextras_dbal_test --entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --mysql-native-password=ON"
77+
# Latest 2 MariaDD LTS versions tested (https://endoflife.date/mariadb)
78+
mariadb1011:
79+
image: mariadb:10.11
6880
env:
6981
MYSQL_DATABASE: nextras_dbal_test
7082
MYSQL_ROOT_PASSWORD: root
7183
ports:
72-
- 3306:3306
84+
- 3308:3306
7385
options: >-
7486
--health-cmd "mysqladmin ping -ppass"
7587
--health-interval 10s
7688
--health-start-period 10s
7789
--health-timeout 5s
7890
--health-retries 10
79-
mysql80:
80-
image: mysql:8.0
81-
ports:
82-
- 3307:3306
83-
options: --health-cmd="mysqladmin ping -ppass" --health-interval=10s --health-timeout=5s --health-retries=5 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=nextras_dbal_test --entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --mysql-native-password=ON"
84-
mariadb105:
85-
image: mariadb:10.5
91+
mariadb1104:
92+
image: mariadb:11.4
8693
env:
8794
MYSQL_DATABASE: nextras_dbal_test
8895
MYSQL_ROOT_PASSWORD: root
8996
ports:
90-
- 3308:3306
97+
- 3309:3306
9198
options: >-
92-
--health-cmd "mysqladmin ping -ppass"
99+
--health-cmd "healthcheck.sh --su-mysql --connect --innodb_initialized"
93100
--health-interval 10s
94101
--health-start-period 10s
95102
--health-timeout 5s
96103
--health-retries 10
104+
# Newest and last supported version (https://endoflife.date/postgresql)
97105
postgres13:
98106
image: postgres:13
99107
env:
@@ -107,8 +115,8 @@ jobs:
107115
--health-interval 10s
108116
--health-timeout 5s
109117
--health-retries 5
110-
postgres16:
111-
image: postgres:16
118+
postgres17:
119+
image: postgres:17
112120
env:
113121
POSTGRES_USER: postgres
114122
POSTGRES_PASSWORD: postgres
@@ -120,6 +128,7 @@ jobs:
120128
--health-interval 10s
121129
--health-timeout 5s
122130
--health-retries 5
131+
# Latest only
123132
mssql:
124133
image: mcr.microsoft.com/mssql/server:latest
125134
env:
@@ -140,14 +149,14 @@ jobs:
140149
uses: actions/checkout@v4
141150

142151
- name: Install Microsoft ODBC
143-
run: |
144-
echo "\n[ODBC]\nPooling=No" > /etc/odbcinst.ini
145-
sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y
146-
sudo cat /etc/odbcinst.ini
152+
run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y
147153

148154
- name: Create MS SQL Database
149155
run: docker exec -i mssql /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE nextras_dbal_test'
150156

157+
- name: Set up Timezones in MariaDB
158+
run: docker exec $(docker ps -q --filter "ancestor=mariadb:11.4") bash -c "apt-get update && apt-get install -y tzdata && mariadb-tzinfo-to-sql /usr/share/zoneinfo 2>/dev/null | mariadb -u root -proot mysql"
159+
151160
- name: Setup PHP cache environment
152161
id: php-extensions-cache
153162
uses: shivammathur/cache-extensions@v1
@@ -170,6 +179,7 @@ jobs:
170179
extensions: ${{ env.php-extensions }}
171180
tools: ${{ env.php-tools }}
172181
coverage: pcov
182+
ini-values: "pdo_odbc.connection_pooling=off"
173183

174184
- name: Get composer cache directory
175185
id: composercache

tests/cases/integration/connection.sqlserver.phpt

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace NextrasTests\Dbal;
99

1010

11-
use Nextras\Dbal\Drivers\Exception\QueryException;
1211
use Tester\Assert;
1312

1413

@@ -19,13 +18,10 @@ class ConnectionSqlServerTest extends IntegrationTestCase
1918
{
2019
public function testReconnect()
2120
{
22-
$this->connection->query('create table #temp (val int)');
23-
$this->connection->query('insert into #temp values (1)');
24-
Assert::same(1, $this->connection->query('SELECT * FROM #temp')->fetchField());
21+
$sessionIdBefore = $this->connection->query('SELECT [connection_id] FROM [sys].[dm_exec_connections] where session_id = @@SPID')->fetchField();
2522
$this->connection->reconnect();
26-
Assert::exception(function () {
27-
$this->connection->query('SELECT * FROM #temp');
28-
}, QueryException::class);
23+
$sessionIdAfter = $this->connection->query('SELECT [connection_id] FROM [sys].[dm_exec_connections] where session_id = @@SPID')->fetchField();
24+
Assert::notEqual($sessionIdBefore, $sessionIdAfter);
2925
}
3026

3127

tests/cases/integration/datetime.mysql.phpt

+8-8
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ class DateTimeMysqlTest extends IntegrationTestCase
4747

4848
$connection->query('DELETE FROM dates_write');
4949
$connection->query('INSERT INTO dates_write VALUES (%ldt, %dt, %ldt)',
50-
new DateTime('2015-01-01 12:00:00'), // local
51-
new DateTime('2015-01-01 12:00:00 Europe/Kiev'), // 10:00 UTC,
52-
new DateTime('2015-01-01 12:13:14') // local
50+
new DateTime('2015-01-01 12:00:00'), // local
51+
new DateTime('2015-01-01 12:00:00 Europe/Helsinki'), // 10:00 UTC,
52+
new DateTime('2015-01-01 12:13:14') // local
5353
);
5454

5555
$result = $connection->query('SELECT * FROM dates_write');
@@ -65,7 +65,7 @@ class DateTimeMysqlTest extends IntegrationTestCase
6565
public function testWriteStorageDiffTZ()
6666
{
6767
$connection = $this->createConnection([
68-
'connectionTz' => 'Europe/Kiev',
68+
'connectionTz' => 'Europe/Helsinki',
6969
]);
7070
$this->lockConnection($connection);
7171

@@ -94,9 +94,9 @@ class DateTimeMysqlTest extends IntegrationTestCase
9494

9595
$connection->query('DELETE FROM dates_write2');
9696
$connection->query('INSERT INTO dates_write2 VALUES (%ldt, %dt, %ldt)',
97-
new \DateTimeImmutable('2015-01-01 12:00:00'), // local
98-
new \DateTimeImmutable('2015-01-01 12:00:00 Europe/Kiev'), // 10:00 UTC
99-
new \DateTimeImmutable('2015-01-01 12:13:14') // local
97+
new \DateTimeImmutable('2015-01-01 12:00:00'), // local
98+
new \DateTimeImmutable('2015-01-01 12:00:00 Europe/Helsinki'), // 10:00 UTC
99+
new \DateTimeImmutable('2015-01-01 12:13:14') // local
100100
);
101101

102102
$result = $connection->query('SELECT * FROM dates_write2');
@@ -144,7 +144,7 @@ class DateTimeMysqlTest extends IntegrationTestCase
144144
public function testReadStorageDiffTZ()
145145
{
146146
$connection = $this->createConnection([
147-
'connectionTz' => 'Europe/Kiev',
147+
'connectionTz' => 'Europe/Helsinki',
148148
]);
149149
$this->lockConnection($connection);
150150

tests/cases/integration/datetime.postgres.phpt

+9-9
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DateTimePostgresTest extends IntegrationTestCase
3333

3434
$connection->query('INSERT INTO dates_write VALUES (%ldt, %dt, %ldt)',
3535
new DateTime('2015-01-01 12:00:00'), // local
36-
new DateTime('2015-01-01 12:00:00'), // 11:00 UTC
36+
new DateTime('2015-01-01 12:00:00'), // 11:00 UTC
3737
new DateTime('2015-01-01 00:00:00') // local
3838
);
3939

@@ -47,9 +47,9 @@ class DateTimePostgresTest extends IntegrationTestCase
4747

4848
$connection->query('DELETE FROM dates_write');
4949
$connection->query('INSERT INTO dates_write VALUES (%ldt, %dt, %ldt)',
50-
new DateTime('2015-01-01 12:00:00'), // local
51-
new DateTime('2015-01-01 12:00:00 Europe/Kiev'), // 10:00 UTC
52-
new DateTime('2015-01-01 12:13:14') // local
50+
new DateTime('2015-01-01 12:00:00'), // local
51+
new DateTime('2015-01-01 12:00:00 Europe/Helsinki'), // 10:00 UTC
52+
new DateTime('2015-01-01 12:13:14') // local
5353
);
5454

5555
$result = $connection->query('SELECT * FROM dates_write');
@@ -65,7 +65,7 @@ class DateTimePostgresTest extends IntegrationTestCase
6565
public function testWriteStorageDiffTZ()
6666
{
6767
$connection = $this->createConnection([
68-
'connectionTz' => 'Europe/Kiev',
68+
'connectionTz' => 'Europe/Helsinki',
6969
]);
7070
$this->lockConnection($connection);
7171

@@ -94,9 +94,9 @@ class DateTimePostgresTest extends IntegrationTestCase
9494

9595
$connection->query('DELETE FROM dates_write2');
9696
$connection->query('INSERT INTO dates_write2 VALUES (%ldt, %dt, %ldt)',
97-
new \DateTimeImmutable('2015-01-01 12:00:00'), // 11:00 UTC
98-
new \DateTimeImmutable('2015-01-01 12:00:00 Europe/Kiev'), // 10:00 UTC
99-
new \DateTimeImmutable('2015-01-01 12:13:14') // local
97+
new \DateTimeImmutable('2015-01-01 12:00:00'), // 11:00 UTC
98+
new \DateTimeImmutable('2015-01-01 12:00:00 Europe/Helsinki'), // 10:00 UTC
99+
new \DateTimeImmutable('2015-01-01 12:13:14') // local
100100
);
101101

102102
$result = $connection->query('SELECT * FROM dates_write2');
@@ -144,7 +144,7 @@ class DateTimePostgresTest extends IntegrationTestCase
144144
public function testReadStorageDiffTZ()
145145
{
146146
$connection = $this->createConnection([
147-
'connectionTz' => 'Europe/Kiev',
147+
'connectionTz' => 'Europe/Helsinki',
148148
]);
149149
$this->lockConnection($connection);
150150

tests/cases/integration/datetime.sqlserver.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DateTimeSqlServerTest extends IntegrationTestCase
4040
Assert::same('2015-01-01 12:00:00.000', $row->a);
4141

4242
// different timezone than db
43-
date_default_timezone_set('Europe/Kiev');
43+
date_default_timezone_set('Europe/Helsinki');
4444

4545
$result = $connection->query('SELECT * FROM dates_write');
4646
$result->setValueNormalization(false);
@@ -74,7 +74,7 @@ class DateTimeSqlServerTest extends IntegrationTestCase
7474

7575
$connection->query('DELETE FROM dates');
7676
$connection->query('INSERT INTO dates VALUES (%dt)',
77-
new DateTime('2015-01-01 13:00:00 Europe/Kiev') // 11:00 UTC
77+
new DateTime('2015-01-01 13:00:00 Europe/Helsinki') // 11:00 UTC
7878
);
7979

8080
$result = $connection->query('SELECT * FROM dates');
@@ -88,7 +88,7 @@ class DateTimeSqlServerTest extends IntegrationTestCase
8888

8989
$connection->query('DELETE FROM dates');
9090
$connection->query('INSERT INTO dates VALUES (%dt)',
91-
new DateTime('2015-01-01 14:00:00 Europe/Kiev') // 12:00 UTC
91+
new DateTime('2015-01-01 14:00:00 Europe/Helsinki') // 12:00 UTC
9292
);
9393

9494
$result = $connection->query('SELECT * FROM dates');

tests/cases/integration/platform.mysql.phpt

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class PlatformMysqlTest extends IntegrationTestCase
2323
{
2424
public function testTables()
2525
{
26+
$this->lockConnection($this->connection);
2627
$dbName = $this->connection->getConfig()['database'];
2728
$tables = $this->connection->getPlatform()->getTables();
2829

@@ -44,6 +45,7 @@ class PlatformMysqlTest extends IntegrationTestCase
4445

4546
public function testColumns()
4647
{
48+
$this->lockConnection($this->connection);
4749
$columns = $this->connection->getPlatform()->getColumns('books');
4850
$columns = array_map(function($table) {
4951
return (array) $table;

tests/cases/integration/platform.postgres.phpt

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class PlatformPostgresTest extends IntegrationTestCase
1818
{
1919
public function testTables()
2020
{
21+
$this->lockConnection($this->connection);
2122
$tables = $this->connection->getPlatform()->getTables();
2223

2324
Assert::true(isset($tables["public.books"]));
@@ -37,6 +38,7 @@ class PlatformPostgresTest extends IntegrationTestCase
3738

3839
public function testColumns()
3940
{
41+
$this->lockConnection($this->connection);
4042
$columns = $this->connection->getPlatform()->getColumns('books');
4143
$columns = \array_map(function ($column) { return (array) $column; }, $columns);
4244

@@ -191,6 +193,7 @@ class PlatformPostgresTest extends IntegrationTestCase
191193

192194
public function testForeignKeys()
193195
{
196+
$this->lockConnection($this->connection);
194197
$keys = $this->connection->getPlatform()->getForeignKeys('books');
195198
$keys = \array_map(function ($key) { return (array) $key; }, $keys);
196199

tests/cases/integration/platform.sqlserver.phpt

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class PlatformSqlServerTest extends IntegrationTestCase
1818
{
1919
public function testTables()
2020
{
21+
$this->lockConnection($this->connection);
2122
$tables = $this->connection->getPlatform()->getTables();
2223

2324
Assert::true(isset($tables["dbo.books"]));
@@ -37,6 +38,7 @@ class PlatformSqlServerTest extends IntegrationTestCase
3738

3839
public function testColumns()
3940
{
41+
$this->lockConnection($this->connection);
4042
$columns = $this->connection->getPlatform()->getColumns('books');
4143
$columns = \array_map(function ($column) { return (array) $column; }, $columns);
4244

0 commit comments

Comments
 (0)