From f429ba94911039bb57d8a03ef43ba4e9e175294a Mon Sep 17 00:00:00 2001 From: Alejandro Ibarra Date: Fri, 7 Jun 2024 10:10:36 +0200 Subject: [PATCH] 2288 - Add expectedDeprecation for CakePHP 4.5 compatibility and update php version to 7.4 --- .github/workflows/ci.yml | 20 +++++++++---------- composer.json | 2 +- tests/Phinx/Db/Adapter/MysqlAdapterTest.php | 3 +++ .../Phinx/Db/Adapter/PostgresAdapterTest.php | 3 +++ tests/Phinx/Db/Adapter/SQLiteAdapterTest.php | 3 +++ .../Phinx/Db/Adapter/SqlServerAdapterTest.php | 3 +++ 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd51c5d74..6aa4199c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,29 +13,29 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.2', '7.4', '8.0', '8.1', '8.2'] + php-version: ['7.4', '8.0', '8.1', '8.2'] db-type: [sqlite, mysql, pgsql] prefer-lowest: [''] include: - - php-version: '7.2' + - php-version: '7.4' db-type: mysql prefer-lowest: prefer-lowest steps: - name: Setup MySQL latest - if: matrix.db-type == 'mysql' && matrix.php-version != '7.2' - run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password + if: matrix.db-type == 'mysql' && matrix.php-version != '7.4' + run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:8.3 --default-authentication-plugin=mysql_native_password - name: Setup MySQL 5.6 - if: matrix.db-type == 'mysql' && matrix.php-version == '7.2' + if: matrix.db-type == 'mysql' && matrix.php-version == '7.4' run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:5.6 --character-set-server=utf8 - name: Setup PostgreSQL latest - if: matrix.db-type == 'pgsql' && matrix.php-version != '7.2' + if: matrix.db-type == 'pgsql' && matrix.php-version != '7.4' run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres - name: Setup PostgreSQL 9.4 - if: matrix.db-type == 'pgsql' && matrix.php-version == '7.2' + if: matrix.db-type == 'pgsql' && matrix.php-version == '7.4' run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres:9.4 - uses: actions/checkout@v3 @@ -70,7 +70,7 @@ jobs: fi - name: Setup problem matchers for PHPUnit - if: matrix.php-version == '7.2' && matrix.db-type == 'mysql' + if: matrix.php-version == '7.4' && matrix.db-type == 'mysql' run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Setup Database @@ -109,11 +109,11 @@ jobs: testsuite-windows: runs-on: windows-2019 - name: Windows - PHP 7.2 & SQL Server + name: Windows - PHP 7.4 & SQL Server env: EXTENSIONS: pdo_sqlsrv - PHP_VERSION: '7.2' + PHP_VERSION: '7.4' steps: - uses: actions/checkout@v3 diff --git a/composer.json b/composer.json index 18b07b3b2..73e6502e3 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ } ], "require": { - "php": ">=7.2", + "php": ">=7.4.0", "cakephp/database": "^4.0", "psr/container": "^1.0 || ^2.0", "symfony/console": "^3.4|^4.0|^5.0|^6.0", diff --git a/tests/Phinx/Db/Adapter/MysqlAdapterTest.php b/tests/Phinx/Db/Adapter/MysqlAdapterTest.php index 419f90aa4..3f4d34721 100644 --- a/tests/Phinx/Db/Adapter/MysqlAdapterTest.php +++ b/tests/Phinx/Db/Adapter/MysqlAdapterTest.php @@ -2070,6 +2070,9 @@ public function testQueryBuilder() ->addColumn('int_col', 'integer') ->save(); + $this->expectDeprecation(); + $this->expectExceptionMessage('As of 4.5.0, using newQuery() is deprecated. Instead, use `insertQuery()`, `deleteQuery()`, `selectQuery()` or `updateQuery()`. The query objects returned by these methods will emit deprecations that will become fatal errors in 5.0.See https://book.cakephp.org/4/en/appendices/4-5-migration-guide.html for more information'); + $builder = $this->adapter->getQueryBuilder(); $stm = $builder ->insert(['string_col', 'int_col']) diff --git a/tests/Phinx/Db/Adapter/PostgresAdapterTest.php b/tests/Phinx/Db/Adapter/PostgresAdapterTest.php index 6599d4e98..d6e1c2311 100644 --- a/tests/Phinx/Db/Adapter/PostgresAdapterTest.php +++ b/tests/Phinx/Db/Adapter/PostgresAdapterTest.php @@ -2415,6 +2415,9 @@ public function testQueryBuilder() ->addColumn('int_col', 'integer') ->save(); + $this->expectDeprecation(); + $this->expectExceptionMessage('As of 4.5.0, using newQuery() is deprecated. Instead, use `insertQuery()`, `deleteQuery()`, `selectQuery()` or `updateQuery()`. The query objects returned by these methods will emit deprecations that will become fatal errors in 5.0.See https://book.cakephp.org/4/en/appendices/4-5-migration-guide.html for more information'); + $builder = $this->adapter->getQueryBuilder(); $stm = $builder ->insert(['string_col', 'int_col']) diff --git a/tests/Phinx/Db/Adapter/SQLiteAdapterTest.php b/tests/Phinx/Db/Adapter/SQLiteAdapterTest.php index 283030328..fd28b95c6 100644 --- a/tests/Phinx/Db/Adapter/SQLiteAdapterTest.php +++ b/tests/Phinx/Db/Adapter/SQLiteAdapterTest.php @@ -1274,6 +1274,9 @@ public function testQueryBuilder() ->addColumn('int_col', 'integer') ->save(); + $this->expectDeprecation(); + $this->expectExceptionMessage('As of 4.5.0, using newQuery() is deprecated. Instead, use `insertQuery()`, `deleteQuery()`, `selectQuery()` or `updateQuery()`. The query objects returned by these methods will emit deprecations that will become fatal errors in 5.0.See https://book.cakephp.org/4/en/appendices/4-5-migration-guide.html for more information'); + $builder = $this->adapter->getQueryBuilder(); $stm = $builder ->insert(['string_col', 'int_col']) diff --git a/tests/Phinx/Db/Adapter/SqlServerAdapterTest.php b/tests/Phinx/Db/Adapter/SqlServerAdapterTest.php index d85dcd629..c0c56338d 100644 --- a/tests/Phinx/Db/Adapter/SqlServerAdapterTest.php +++ b/tests/Phinx/Db/Adapter/SqlServerAdapterTest.php @@ -1130,6 +1130,9 @@ public function testQueryBuilder() ->addColumn('int_col', 'integer') ->save(); + $this->expectDeprecation(); + $this->expectExceptionMessage('As of 4.5.0, using newQuery() is deprecated. Instead, use `insertQuery()`, `deleteQuery()`, `selectQuery()` or `updateQuery()`. The query objects returned by these methods will emit deprecations that will become fatal errors in 5.0.See https://book.cakephp.org/4/en/appendices/4-5-migration-guide.html for more information'); + $builder = $this->adapter->getQueryBuilder(); $stm = $builder ->insert(['string_col', 'int_col'])