In core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php file change static queries to dynamic queries in testDefaultInsert(), testDefaultEmptyInsert() and testDefaultInsertWithFields() methods.
Problem/Motivation
As per title
Proposed resolution
$num_records_before = (int) $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField();
-
+ $num_records_before = $this->connection->select('test')
+ ->countQuery()
+ ->execute()
+ ->fetchField();
- $job = $this->connection->query('SELECT job FROM {test} WHERE id = :id', [':id' => $id])->fetchField();
+ $job = $this->connection->select('test', 't')
+ ->fields('t', ['job'])
+ ->condition('id', $id)
+ ->execute()
+ ->fetchField();
Remaining tasks
TBD
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
TBD
Comments
Comment #2
hardik_patel_12 commentedKindly review the patch.
Comment #3
siddhant.bhosale commentedHi @hardik_patel_12, The patch looks good and applies cleanly, but please refer to the issue https://www.drupal.org/project/drupal/issues/3152398.
It mentions not to change the static queries in the directory core/tests/Drupal/KernelTests/Core/Database.
Please let me know if I am missing anything or we can close the issue.
Comment #4
avpaderno@sdiddhant-bhosale Yes, that is correct.
core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php is in that directory.
I am closing this issue.