diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 58bd355..db5b170 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -2,5 +2,6 @@ "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ "config:recommended", + "schedule:earlyMondays" ], } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bba2ca0..e1a9008 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ on: - v*.* env: - php-extensions: mbstring, intl, mysqli, pgsql, sqlsrv-5.10.0-beta1, pdo_sqlsrv-5.10.0-beta1 + php-extensions: mbstring, intl, mysqli, pgsql, sqlsrv, pdo_sqlsrv php-extensions-key: v1 php-tools: "composer:v2, pecl" @@ -63,37 +63,45 @@ jobs: runs-on: ubuntu-latest services: - mysql57: - image: mysql:5.7 + # MySQL LTS versions tested (https://endoflife.date/mysql) + mysql80: + image: mysql:8.0 + ports: + - 3306:3306 + 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" + mysql84: + image: mysql:8.4 + ports: + - 3307:3306 + 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" + # Latest 2 MariaDD LTS versions tested (https://endoflife.date/mariadb) + mariadb1011: + image: mariadb:10.11 env: MYSQL_DATABASE: nextras_dbal_test MYSQL_ROOT_PASSWORD: root ports: - - 3306:3306 + - 3308:3306 options: >- --health-cmd "mysqladmin ping -ppass" --health-interval 10s --health-start-period 10s --health-timeout 5s --health-retries 10 - mysql80: - image: mysql:8.0 - ports: - - 3307:3306 - 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" - mariadb105: - image: mariadb:10.5 + mariadb1104: + image: mariadb:11.4 env: MYSQL_DATABASE: nextras_dbal_test MYSQL_ROOT_PASSWORD: root ports: - - 3308:3306 + - 3309:3306 options: >- - --health-cmd "mysqladmin ping -ppass" + --health-cmd "healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval 10s --health-start-period 10s --health-timeout 5s --health-retries 10 + # Newest and last supported version (https://endoflife.date/postgresql) postgres13: image: postgres:13 env: @@ -107,8 +115,8 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - postgres16: - image: postgres:16 + postgres17: + image: postgres:17 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres @@ -120,6 +128,7 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 + # Latest only mssql: image: mcr.microsoft.com/mssql/server:latest env: @@ -140,14 +149,14 @@ jobs: uses: actions/checkout@v4 - name: Install Microsoft ODBC - run: | - echo "\n[ODBC]\nPooling=No" > /etc/odbcinst.ini - sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y - sudo cat /etc/odbcinst.ini + run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y - name: Create MS SQL Database run: docker exec -i mssql /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE nextras_dbal_test' + - name: Set up Timezones in MariaDB + 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" + - name: Setup PHP cache environment id: php-extensions-cache uses: shivammathur/cache-extensions@v1 @@ -170,6 +179,7 @@ jobs: extensions: ${{ env.php-extensions }} tools: ${{ env.php-tools }} coverage: pcov + ini-values: "pdo_odbc.connection_pooling=off" - name: Get composer cache directory id: composercache diff --git a/tests/cases/integration/connection.sqlserver.phpt b/tests/cases/integration/connection.sqlserver.phpt index ae7813c..7bfc339 100644 --- a/tests/cases/integration/connection.sqlserver.phpt +++ b/tests/cases/integration/connection.sqlserver.phpt @@ -8,7 +8,6 @@ namespace NextrasTests\Dbal; -use Nextras\Dbal\Drivers\Exception\QueryException; use Tester\Assert; @@ -19,13 +18,10 @@ class ConnectionSqlServerTest extends IntegrationTestCase { public function testReconnect() { - $this->connection->query('create table #temp (val int)'); - $this->connection->query('insert into #temp values (1)'); - Assert::same(1, $this->connection->query('SELECT * FROM #temp')->fetchField()); + $sessionIdBefore = $this->connection->query('SELECT [connection_id] FROM [sys].[dm_exec_connections] where session_id = @@SPID')->fetchField(); $this->connection->reconnect(); - Assert::exception(function () { - $this->connection->query('SELECT * FROM #temp'); - }, QueryException::class); + $sessionIdAfter = $this->connection->query('SELECT [connection_id] FROM [sys].[dm_exec_connections] where session_id = @@SPID')->fetchField(); + Assert::notEqual($sessionIdBefore, $sessionIdAfter); } diff --git a/tests/cases/integration/datetime.mysql.phpt b/tests/cases/integration/datetime.mysql.phpt index 5b91f2c..7cef10b 100644 --- a/tests/cases/integration/datetime.mysql.phpt +++ b/tests/cases/integration/datetime.mysql.phpt @@ -47,9 +47,9 @@ class DateTimeMysqlTest extends IntegrationTestCase $connection->query('DELETE FROM dates_write'); $connection->query('INSERT INTO dates_write VALUES (%ldt, %dt, %ldt)', - new DateTime('2015-01-01 12:00:00'), // local - new DateTime('2015-01-01 12:00:00 Europe/Kiev'), // 10:00 UTC, - new DateTime('2015-01-01 12:13:14') // local + new DateTime('2015-01-01 12:00:00'), // local + new DateTime('2015-01-01 12:00:00 Europe/Helsinki'), // 10:00 UTC, + new DateTime('2015-01-01 12:13:14') // local ); $result = $connection->query('SELECT * FROM dates_write'); @@ -65,7 +65,7 @@ class DateTimeMysqlTest extends IntegrationTestCase public function testWriteStorageDiffTZ() { $connection = $this->createConnection([ - 'connectionTz' => 'Europe/Kiev', + 'connectionTz' => 'Europe/Helsinki', ]); $this->lockConnection($connection); @@ -94,9 +94,9 @@ class DateTimeMysqlTest extends IntegrationTestCase $connection->query('DELETE FROM dates_write2'); $connection->query('INSERT INTO dates_write2 VALUES (%ldt, %dt, %ldt)', - new \DateTimeImmutable('2015-01-01 12:00:00'), // local - new \DateTimeImmutable('2015-01-01 12:00:00 Europe/Kiev'), // 10:00 UTC - new \DateTimeImmutable('2015-01-01 12:13:14') // local + new \DateTimeImmutable('2015-01-01 12:00:00'), // local + new \DateTimeImmutable('2015-01-01 12:00:00 Europe/Helsinki'), // 10:00 UTC + new \DateTimeImmutable('2015-01-01 12:13:14') // local ); $result = $connection->query('SELECT * FROM dates_write2'); @@ -144,7 +144,7 @@ class DateTimeMysqlTest extends IntegrationTestCase public function testReadStorageDiffTZ() { $connection = $this->createConnection([ - 'connectionTz' => 'Europe/Kiev', + 'connectionTz' => 'Europe/Helsinki', ]); $this->lockConnection($connection); diff --git a/tests/cases/integration/datetime.postgres.phpt b/tests/cases/integration/datetime.postgres.phpt index 24961c5..8cd2fa2 100644 --- a/tests/cases/integration/datetime.postgres.phpt +++ b/tests/cases/integration/datetime.postgres.phpt @@ -33,7 +33,7 @@ class DateTimePostgresTest extends IntegrationTestCase $connection->query('INSERT INTO dates_write VALUES (%ldt, %dt, %ldt)', new DateTime('2015-01-01 12:00:00'), // local - new DateTime('2015-01-01 12:00:00'), // 11:00 UTC + new DateTime('2015-01-01 12:00:00'), // 11:00 UTC new DateTime('2015-01-01 00:00:00') // local ); @@ -47,9 +47,9 @@ class DateTimePostgresTest extends IntegrationTestCase $connection->query('DELETE FROM dates_write'); $connection->query('INSERT INTO dates_write VALUES (%ldt, %dt, %ldt)', - new DateTime('2015-01-01 12:00:00'), // local - new DateTime('2015-01-01 12:00:00 Europe/Kiev'), // 10:00 UTC - new DateTime('2015-01-01 12:13:14') // local + new DateTime('2015-01-01 12:00:00'), // local + new DateTime('2015-01-01 12:00:00 Europe/Helsinki'), // 10:00 UTC + new DateTime('2015-01-01 12:13:14') // local ); $result = $connection->query('SELECT * FROM dates_write'); @@ -65,7 +65,7 @@ class DateTimePostgresTest extends IntegrationTestCase public function testWriteStorageDiffTZ() { $connection = $this->createConnection([ - 'connectionTz' => 'Europe/Kiev', + 'connectionTz' => 'Europe/Helsinki', ]); $this->lockConnection($connection); @@ -94,9 +94,9 @@ class DateTimePostgresTest extends IntegrationTestCase $connection->query('DELETE FROM dates_write2'); $connection->query('INSERT INTO dates_write2 VALUES (%ldt, %dt, %ldt)', - new \DateTimeImmutable('2015-01-01 12:00:00'), // 11:00 UTC - new \DateTimeImmutable('2015-01-01 12:00:00 Europe/Kiev'), // 10:00 UTC - new \DateTimeImmutable('2015-01-01 12:13:14') // local + new \DateTimeImmutable('2015-01-01 12:00:00'), // 11:00 UTC + new \DateTimeImmutable('2015-01-01 12:00:00 Europe/Helsinki'), // 10:00 UTC + new \DateTimeImmutable('2015-01-01 12:13:14') // local ); $result = $connection->query('SELECT * FROM dates_write2'); @@ -144,7 +144,7 @@ class DateTimePostgresTest extends IntegrationTestCase public function testReadStorageDiffTZ() { $connection = $this->createConnection([ - 'connectionTz' => 'Europe/Kiev', + 'connectionTz' => 'Europe/Helsinki', ]); $this->lockConnection($connection); diff --git a/tests/cases/integration/datetime.sqlserver.phpt b/tests/cases/integration/datetime.sqlserver.phpt index f4fae06..c00509a 100644 --- a/tests/cases/integration/datetime.sqlserver.phpt +++ b/tests/cases/integration/datetime.sqlserver.phpt @@ -40,7 +40,7 @@ class DateTimeSqlServerTest extends IntegrationTestCase Assert::same('2015-01-01 12:00:00.000', $row->a); // different timezone than db - date_default_timezone_set('Europe/Kiev'); + date_default_timezone_set('Europe/Helsinki'); $result = $connection->query('SELECT * FROM dates_write'); $result->setValueNormalization(false); @@ -74,7 +74,7 @@ class DateTimeSqlServerTest extends IntegrationTestCase $connection->query('DELETE FROM dates'); $connection->query('INSERT INTO dates VALUES (%dt)', - new DateTime('2015-01-01 13:00:00 Europe/Kiev') // 11:00 UTC + new DateTime('2015-01-01 13:00:00 Europe/Helsinki') // 11:00 UTC ); $result = $connection->query('SELECT * FROM dates'); @@ -88,7 +88,7 @@ class DateTimeSqlServerTest extends IntegrationTestCase $connection->query('DELETE FROM dates'); $connection->query('INSERT INTO dates VALUES (%dt)', - new DateTime('2015-01-01 14:00:00 Europe/Kiev') // 12:00 UTC + new DateTime('2015-01-01 14:00:00 Europe/Helsinki') // 12:00 UTC ); $result = $connection->query('SELECT * FROM dates'); diff --git a/tests/cases/integration/platform.mysql.phpt b/tests/cases/integration/platform.mysql.phpt index 8cec5bc..7514d59 100644 --- a/tests/cases/integration/platform.mysql.phpt +++ b/tests/cases/integration/platform.mysql.phpt @@ -23,6 +23,7 @@ class PlatformMysqlTest extends IntegrationTestCase { public function testTables() { + $this->lockConnection($this->connection); $dbName = $this->connection->getConfig()['database']; $tables = $this->connection->getPlatform()->getTables(); @@ -44,6 +45,7 @@ class PlatformMysqlTest extends IntegrationTestCase public function testColumns() { + $this->lockConnection($this->connection); $columns = $this->connection->getPlatform()->getColumns('books'); $columns = array_map(function($table) { return (array) $table; diff --git a/tests/cases/integration/platform.postgres.phpt b/tests/cases/integration/platform.postgres.phpt index 9acd1ce..913bcb8 100644 --- a/tests/cases/integration/platform.postgres.phpt +++ b/tests/cases/integration/platform.postgres.phpt @@ -18,6 +18,7 @@ class PlatformPostgresTest extends IntegrationTestCase { public function testTables() { + $this->lockConnection($this->connection); $tables = $this->connection->getPlatform()->getTables(); Assert::true(isset($tables["public.books"])); @@ -37,6 +38,7 @@ class PlatformPostgresTest extends IntegrationTestCase public function testColumns() { + $this->lockConnection($this->connection); $columns = $this->connection->getPlatform()->getColumns('books'); $columns = \array_map(function ($column) { return (array) $column; }, $columns); @@ -191,6 +193,7 @@ class PlatformPostgresTest extends IntegrationTestCase public function testForeignKeys() { + $this->lockConnection($this->connection); $keys = $this->connection->getPlatform()->getForeignKeys('books'); $keys = \array_map(function ($key) { return (array) $key; }, $keys); diff --git a/tests/cases/integration/platform.sqlserver.phpt b/tests/cases/integration/platform.sqlserver.phpt index 397f956..0780f84 100644 --- a/tests/cases/integration/platform.sqlserver.phpt +++ b/tests/cases/integration/platform.sqlserver.phpt @@ -18,6 +18,7 @@ class PlatformSqlServerTest extends IntegrationTestCase { public function testTables() { + $this->lockConnection($this->connection); $tables = $this->connection->getPlatform()->getTables(); Assert::true(isset($tables["dbo.books"])); @@ -37,6 +38,7 @@ class PlatformSqlServerTest extends IntegrationTestCase public function testColumns() { + $this->lockConnection($this->connection); $columns = $this->connection->getPlatform()->getColumns('books'); $columns = \array_map(function ($column) { return (array) $column; }, $columns); diff --git a/tests/databases.github.ini b/tests/databases.github.ini index f11ae96..f3127e3 100644 --- a/tests/databases.github.ini +++ b/tests/databases.github.ini @@ -1,4 +1,4 @@ -[mysql 5.7] +[mysql 8.0] driver = mysqli host = "127.0.0.1" database = nextras_dbal_test @@ -6,7 +6,7 @@ username = root password = root port = 3306 -[mysql 5.7pdo] +[mysql 8.0pdo] driver = pdo_mysql host = "127.0.0.1" database = nextras_dbal_test @@ -14,7 +14,7 @@ username = root password = root port = 3306 -[mysql 8.0] +[mysql 8.4] driver = mysqli host = "127.0.0.1" database = nextras_dbal_test @@ -22,7 +22,7 @@ username = root password = root port = 3307 -[mysql 8.0pdo] +[mysql 8.4pdo] driver = pdo_mysql host = "127.0.0.1" database = nextras_dbal_test @@ -30,7 +30,7 @@ username = root password = root port = 3307 -[mysql mariadb105] +[mysql mariadb1011] driver = mysqli host = "127.0.0.1" database = nextras_dbal_test @@ -38,7 +38,7 @@ username = root password = root port = 3308 -[mysql mariadb105pdo] +[mysql mariadb1011pdo] driver = pdo_mysql host = "127.0.0.1" database = nextras_dbal_test @@ -46,6 +46,22 @@ username = root password = root port = 3308 +[mysql mariadb1104] +driver = mysqli +host = "127.0.0.1" +database = nextras_dbal_test +username = root +password = root +port = 3309 + +[mysql mariadb1104pdo] +driver = pdo_mysql +host = "127.0.0.1" +database = nextras_dbal_test +username = root +password = root +port = 3309 + [pgsql 13] driver = pgsql host = "127.0.0.1" @@ -62,7 +78,7 @@ username = postgres password = postgres port = 5432 -[pgsql 16] +[pgsql 17] driver = pgsql host = "127.0.0.1" database = nextras_dbal_test @@ -70,7 +86,7 @@ username = postgres password = postgres port = 5433 -[pgsql 16pdo] +[pgsql 17pdo] driver = pdo_pgsql host = "127.0.0.1" database = nextras_dbal_test