From 405a9da33f2f9f473d52573156eadcf9df2e3c32 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Sun, 12 Feb 2023 23:35:52 +0100 Subject: [PATCH] 5.x: fix tests --- tests/TestCase/DebugSqlTest.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/TestCase/DebugSqlTest.php b/tests/TestCase/DebugSqlTest.php index 8e90e3eb..1175dca6 100644 --- a/tests/TestCase/DebugSqlTest.php +++ b/tests/TestCase/DebugSqlTest.php @@ -14,6 +14,7 @@ */ namespace DebugKit\Test\TestCase; +use Cake\Database\Driver\Postgres; use Cake\Datasource\ConnectionManager; use Cake\TestSuite\TestCase; use DebugKit\DebugSql; @@ -77,15 +78,11 @@ public function testSqlHtmlOnCli()
%s (line %d)
-SELECT
-  panels.id AS %s
-FROM
-  panels panels
-
-
+SELECT EXPECTED; - $expected = sprintf($expected, str_replace(ROOT, '', __FILE__), __LINE__ - 9); - $this->assertTextContains(str_replace("\r", '', $expected), str_replace("\r", '', $result)); + $fieldName = $this->connection->getDriver() instanceof Postgres ? '"panels__id"' : 'panels__id'; + $expected = sprintf($expected, str_replace(ROOT, '', __FILE__), __LINE__ - 10, $fieldName); + $this->assertTextContains(str_replace(["\n", "\r"], '', $expected), str_replace(["\n", "\r"], '', $result)); } /**