From ddd53dd87417da358cf0403fdf114a9d198280cc Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Sun, 5 Feb 2023 17:33:37 +0900 Subject: [PATCH] test: Fixed PostgresTest::testAlterSchema() The last few lines of PostgresTest::testAlterSchema() were added in the following commit. There was a problem, but the test succeeds in less than PHP 7.4. https://github.com/cakephp/cakephp/commit/6a4e7558fcceb06ec05f345ba85c0ea54f36c39e#diff-bb8406239275388d1950fd590496d45d70b9e85b1c521ec75837e1138c9743d9 In PHP 7.4+, after executing DboSource::dropSchema(), executing DboSource::alterSchema() raises a "Warning Error" and the test fails. --- lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php index 01da8ebcd..0974b0959 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php @@ -703,8 +703,6 @@ class PostgresTest extends CakeTestCase { $this->assertEquals(true, $result['author_id']['null']); $this->assertEquals(false, $result['title']['null']); - $this->Dbo->query($this->Dbo->dropSchema($New)); - $New = new CakeSchema(array( 'connection' => 'test_suite', 'name' => 'AlterPosts', @@ -720,6 +718,8 @@ class PostgresTest extends CakeTestCase { )); $result = $this->Dbo->alterSchema($New->compare($Old), 'alter_posts'); $this->assertDoesNotMatchRegularExpression('/varchar\(36\) NOT NULL/i', $result); + + $this->Dbo->query($this->Dbo->dropSchema($New)); } /**