In core/tests/Drupal/KernelTests/Core/Database/UpdateLobTest.php file change static queries to dynamic queries in testUpdateOneBlob() and testUpdateMultipleBlob() methods.

Problem/Motivation

In testUpdateOneBlob()method

    $r = $this->connection->query('SELECT * FROM {test_one_blob} WHERE id = :id', [':id' => $id])->fetchAssoc();

In testUpdateMultipleBlob()method

        $r = $this->connection->query('SELECT * FROM {test_two_blobs} WHERE id = :id', [':id' => $id])->fetchAssoc();

Proposed resolution

In testUpdateOneBlob()method

$r = \Drupal::database()->select('test_one_blob', 'tob')
      ->fields('tob')
      ->condition('id', $id)
      ->execute()
      ->fetchAssoc();

In testUpdateMultipleBlob()method

$r = \Drupal::database()->select('test_two_blobs', 'ttb')
      ->fields('ttb')
      ->condition('id', $id)
      ->execute()
      ->fetchAssoc();

Remaining tasks

TBD

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

TBD

CommentFileSizeAuthor
#2 3156191-2.patch1.36 KBhardik_patel_12

Comments

Hardik_Patel_12 created an issue. See original summary.

hardik_patel_12’s picture

Status: Active » Needs review
StatusFileSize
new1.36 KB

Kindly review the patch.

siddhant.bhosale’s picture

Hi @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.

daffie’s picture

Status: Needs review » Closed (won't fix)

In the directory "core/tests/Drupal/KernelTests/Core/Database" are the tests for testing our dynamic queries. That is done by comparing the results of a dynamic query with the results of a static query. The change in this patch will result in testing the results of 2 dynamic queries with each other and that is not what we want. Therefore closing this issue with "will not fix".