Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#3 | 3126029-3.query-quotes.patch | 1.36 KB | jonathan1055 |
Comments
Comment #2
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedHere 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.
Comment #3
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedGood, worked as planned. The first test is fixed. The second now reports the fault correctly:
Patch #3 fixes both tests.
Comment #4
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThat's good. Only the webprofiler tests now fail in D9.
Comment #6
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedFixed and committed.
Comment #7
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI 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.