Skip to content

Commit 99fac0b

Browse files
authored
Merge pull request #954 from cakephp/5.x-merge-4.next
merge 4.next into 5.x
2 parents dd4fd49 + 91e79e3 commit 99fac0b

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

tests/TestCase/DebugSqlTest.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515
namespace DebugKit\Test\TestCase;
1616

17-
use Cake\Database\Driver\Postgres;
1817
use Cake\Datasource\ConnectionManager;
1918
use Cake\TestSuite\TestCase;
2019
use DebugKit\DebugSql;
@@ -72,17 +71,13 @@ public function testSqlHtmlOnCli()
7271

7372
ob_start();
7473
$this->assertSame($query, DebugSql::sql($query, true, true));
75-
$result = ob_get_clean();
74+
$result = strip_tags(ob_get_clean());
75+
$result = preg_replace("/[\n\r]/", '', $result);
7676

77-
$expected = <<<EXPECTED
78-
<div class="cake-debug-output">
79-
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
80-
<pre class="cake-debug">
81-
<span style="font-weight:bold;">SELECT</span>
82-
EXPECTED;
83-
$fieldName = $this->connection->getDriver() instanceof Postgres ? '"panels__id"' : 'panels__id';
84-
$expected = sprintf($expected, str_replace(ROOT, '', __FILE__), __LINE__ - 10, $fieldName);
85-
$this->assertTextContains(str_replace(["\n", "\r"], '', $expected), str_replace(["\n", "\r"], '', $result));
77+
$this->assertStringContainsString(sprintf('%s (line %s)', str_replace(ROOT, '', __FILE__), __LINE__ - 4), $result);
78+
$this->assertStringContainsString('SELECT panels.id AS', $result);
79+
$this->assertStringContainsString('panels__id', $result);
80+
$this->assertStringContainsString('FROM panels panels', $result);
8681
}
8782

8883
/**

0 commit comments

Comments
 (0)