In the branch tests running at core 9.0.x we have the error

1) Drupal\Tests\devel\Kernel\DevelQueryDebugTest::testSelectQueryDebugTag
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'SELECT "u"."uid" AS "uid"\n
+'SELECT u.uid AS uid\n
 FROM\n
-{users} "u"'
+{users} u'

and a similar one for DevelQueryDebugTest::testEntityQueryDebugTag.

The test output is confusing because the Expected and Actual are the wrong way round. This is probably because at some point in the past assertEqual() has been replaced with assertEquals() without noticing that the parameters have now switched. The first should be the expected value, the second should be the actual value.
See the API reference for assertEqual and for details.

Patch to follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.25 KB

Here is a patch which deals with the first test, removing all quotes from the actual message as we are only interested in the content. It also correctly swaps the parameters so we have $this->assertEquals($expected_message, $actual_message)

To prove the point, in the second failed test, the swap is done but the actual message is not changed. This should fail but show the actual with quotes and expected without quotes as is written in the tests.

jonathan1055’s picture

Good, worked as planned. The first test is fixed. The second now reports the fault correctly:

1) Drupal\Tests\devel\Kernel\DevelQueryDebugTest::testEntityQueryDebugTag
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'SELECT base_table.uid AS uid, base_table.uid AS base_table_uid\n
+'SELECT "base_table"."uid" AS "uid", "base_table"."uid" AS "base_table_uid"\n
 FROM\n
-{users} base_table'
+{users} "base_table"'

Patch #3 fixes both tests.

jonathan1055’s picture

That's good. Only the webprofiler tests now fail in D9.

  • jonathan1055 committed 5f936a4 on 8.x-3.x
    Issue #3126029 by jonathan1055: Quoted query text in DevelQueryDebugTest...
jonathan1055’s picture

Status: Needs review » Fixed

Fixed and committed.

jonathan1055’s picture

I have committed this to the add-gitlab-pipeline branch as shown by https://git.drupalcode.org/project/devel/-/commit/cd74d74d987418b6f032d4...

Don't know why it is not showing on this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.