Skip to content

Commit

Permalink
2288 - Add expectedDeprecation for CakePHP 4.5 compatibility and upda…
Browse files Browse the repository at this point in the history
…te php version to 7.4
  • Loading branch information
ajibarra committed Jun 7, 2024
1 parent 60b688d commit f429ba9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions tests/Phinx/Db/Adapter/MysqlAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
3 changes: 3 additions & 0 deletions tests/Phinx/Db/Adapter/PostgresAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
3 changes: 3 additions & 0 deletions tests/Phinx/Db/Adapter/SQLiteAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
3 changes: 3 additions & 0 deletions tests/Phinx/Db/Adapter/SqlServerAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit f429ba9

Please sign in to comment.