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.
6a4e7558fc (diff-bb8406239275388d1950fd590496d45d70b9e85b1c521ec75837e1138c9743d9)
In PHP 7.4+, after executing DboSource::dropSchema(), executing DboSource::alterSchema() raises a "Warning Error" and the test fails.
This commit is contained in:
Koji Tanaka 2023-02-05 17:33:37 +09:00 committed by Kamil Wylegala
parent ca2c909ac9
commit ddd53dd874

View file

@ -703,8 +703,6 @@ class PostgresTest extends CakeTestCase {
$this->assertEquals(true, $result['author_id']['null']); $this->assertEquals(true, $result['author_id']['null']);
$this->assertEquals(false, $result['title']['null']); $this->assertEquals(false, $result['title']['null']);
$this->Dbo->query($this->Dbo->dropSchema($New));
$New = new CakeSchema(array( $New = new CakeSchema(array(
'connection' => 'test_suite', 'connection' => 'test_suite',
'name' => 'AlterPosts', 'name' => 'AlterPosts',
@ -720,6 +718,8 @@ class PostgresTest extends CakeTestCase {
)); ));
$result = $this->Dbo->alterSchema($New->compare($Old), 'alter_posts'); $result = $this->Dbo->alterSchema($New->compare($Old), 'alter_posts');
$this->assertDoesNotMatchRegularExpression('/varchar\(36\) NOT NULL/i', $result); $this->assertDoesNotMatchRegularExpression('/varchar\(36\) NOT NULL/i', $result);
$this->Dbo->query($this->Dbo->dropSchema($New));
} }
/** /**