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.
Followup to #2875394: Replace all calls to db_query, which is deprecated
grep -inr -e "db_query" core/tests/Drupal/KernelTests/Core/Database
Comment | File | Size | Author |
---|---|---|---|
#20 | interdiff-2939387-16-20.txt | 44.11 KB | voleger |
#20 | replace_all_db_query_calls-2939387-20-8.6.x.patch | 64.28 KB | voleger |
#16 | replace_all_db_query_calls-2939387-16-8.6.x.patch | 64.81 KB | voleger |
Comments
Comment #2
volegerComment #3
volegerReformatted changed lines. Tried to increase readability.
Comment #4
volegerComment #6
volegergrep -inr -e "db_query" core/tests/Drupal/KernelTests/Core/Database
Comment #7
apadernoShould not tests avoid using
\Drupal
and use$this->container
instead?Comment #8
volegerhttps://www.drupal.org/core/scope#examples
In this scope, the goal is just replacements. Any other changes should be done in the followup issues.
Comment #9
volegerHm, almost all tests extend DatabaseTestBase so it's not so hard to replace that calls.
And this patch contains
core/tests/Drupal/KernelTests/Core/Database/*
files only.@kiamlaluno thank's for the suggestion.
Comment #10
apadernoThe indentation is wrong. It should be the following one.
For the rest the patch is fine.
If somebody else doesn't find other mistakes, the patch for me is ready to RTBC.
Comment #11
voleger#10 Added indentation.
Comment #12
apadernoComment #13
volegerNeeds reroll
Comment #14
volegerComment #15
voleger#2848812: Replace all calls to db_set_active, which is deprecated. already in 8.5.x
Comment #16
volegerreroll
Should be good for RTBC
Comment #18
volegerComment #19
volegerComment #20
volegerRefactored changes regarding #2953385: Add a $connection property to DatabaseTestBase kernel test class to be used by extending classes
Comment #21
mondrakeBlocker was committed, un-postponing
Comment #22
mondrakeI understand this should minimize impact, but it seems strange to initialise a local
$database
variable here. Can't we just use$this->connection
?I don't think this is correct in this case - I'd just use
$this->connection->query
instead. Thecall_user_func_array
is correct a few lines below because in that case we want to test a call that does not have a file in the backtrace.Uhm is there a reason we extend from
KernelTestBase
here and not fromDatabaseTestBase
? In that case that would not be needed and we could just use$this->connection...
here too.Comment #25
volegerSo we will work on the scripted patch.
Follow #2875394: Replace all calls to db_query, which is deprecated