Problem/Motivation
We should be using static queries as little as possible, because they can result into problems for a some databases. A static query may work on a number of databases, but not on an other one. Dynamic queries are a little bit slower then static queries and for use in tests that is not a problem.
Proposed resolution
Change the static queries in the directory "core/tests/Drupal/FunctionalTests" and its sub-directories. Also do the same when in the directory "core/tests/Drupal/KernelTests" and its sub-directories, but not in the directory "core/tests/Drupal/KernelTests/Core/Database".
What needs to be changed:
From:
$connection->query('SELECT nid FROM {node} WHERE nid = :id', [':id' => 1']);
To:
$connection->select('node')
->fields('node', ['nid'])
->condition('nid', 1)
->execute();
Remaining tasks
TBD
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
TBD