From 02950257b4c2633f74db807a2cc040530e4911d6 Mon Sep 17 00:00:00 2001 From: mscherer Date: Sat, 9 May 2026 22:01:03 +0200 Subject: [PATCH] Fix testCreateTableIndexWithWhere to look up the query by content The test was hardcoding queries[2] to find the CREATE UNIQUE INDEX output. The dryrun message buffer now contains additional phinxlog setup messages before the create-index call, so the position drifted and the test failed locally. Look the query up by its expected prefix instead, which makes the test robust to ordering changes around it. --- tests/TestCase/Db/Adapter/SqliteAdapterTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/TestCase/Db/Adapter/SqliteAdapterTest.php b/tests/TestCase/Db/Adapter/SqliteAdapterTest.php index a66031d5..bd90a7e5 100644 --- a/tests/TestCase/Db/Adapter/SqliteAdapterTest.php +++ b/tests/TestCase/Db/Adapter/SqliteAdapterTest.php @@ -378,7 +378,13 @@ public function testCreateTableIndexWithWhere(): void ->addIndex($index) ->save(); $queries = $this->out->messages(); - $indexQuery = $queries[2]; + $indexQuery = ''; + foreach ($queries as $query) { + if (str_contains($query, 'CREATE UNIQUE INDEX "table1_email_index"')) { + $indexQuery = $query; + break; + } + } $this->assertStringContainsString('CREATE UNIQUE INDEX "table1_email_index"', $indexQuery); $this->assertStringContainsString('("email" ASC) WHERE is_verified = true', $indexQuery); }