From 12340e9600d81434bbc2c34a346c9480329d4fcd Mon Sep 17 00:00:00 2001 From: Alejandro Ibarra Date: Fri, 24 May 2024 13:29:26 +0200 Subject: [PATCH] Fix tests for MySQL 8.4 (#2281) --- .github/workflows/ci.yml | 10 +++++++--- tests/Phinx/Db/Adapter/MysqlAdapterTest.php | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 614e13bff..d10b36a64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.1', '8.2'] + php-version: ['8.1', '8.2', '8.3'] db-type: [sqlite, mysql, pgsql] prefer-lowest: [''] include: @@ -27,8 +27,12 @@ jobs: steps: - name: Setup MySQL latest - if: matrix.db-type == 'mysql' && matrix.php-version != '8.1' - run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:8.3 + if: matrix.db-type == 'mysql' && matrix.php-version == '8.3' + run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:8.4 + + - name: Setup MySQL 8.0 + if: matrix.db-type == 'mysql' && matrix.php-version == '8.2' + run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:8.0 - name: Setup MySQL 5.6 if: matrix.db-type == 'mysql' && matrix.php-version == '8.1' diff --git a/tests/Phinx/Db/Adapter/MysqlAdapterTest.php b/tests/Phinx/Db/Adapter/MysqlAdapterTest.php index b53a042ed..62a8332d1 100644 --- a/tests/Phinx/Db/Adapter/MysqlAdapterTest.php +++ b/tests/Phinx/Db/Adapter/MysqlAdapterTest.php @@ -1808,7 +1808,7 @@ public function testDropForeignKeyByNonExistentKeyColumns(array $columns) $refTable = new Table('ref_table', [], $this->adapter); $refTable ->addColumn('field1', 'string', ['limit' => 8]) - ->addIndex(['id', 'field1']) + ->addIndex(['id', 'field1'], ['unique' => true]) ->save(); $table = new Table('table', [], $this->adapter); @@ -1897,7 +1897,7 @@ public function testDropForeignKeyAsString() public function testHasForeignKey($tableDef, $key, $exp) { $conn = $this->adapter->getConnection(); - $conn->exec('CREATE TABLE other(a int, b int, c int, key(a), key(b), key(a,b), key(a,b,c));'); + $conn->exec('CREATE TABLE other(a int, b int, c int, unique key(a), unique key(b), unique key(a,b), unique key(a,b,c));'); $conn->exec($tableDef); $this->assertSame($exp, $this->adapter->hasForeignKey('t', $key)); }