Closed (fixed)
Project:
Drupal core
Version:
8.9.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Jul 2020 at 12:15 UTC
Updated:
14 Aug 2020 at 14:59 UTC
Jump to comment: Most recent
In core/tests/Drupal/KernelTests/Core/Database/SelectComplexTest.php file testRange() function has unused variables such as $name_field and $age_field
public function testRangeUndo() {
$query = $this->connection->select('test');
$name_field = $query->addField('test', 'name');
$age_field = $query->addField('test', 'age', 'age');
$query->range(0, 2);
$query->range(NULL, NULL);
$query_result = $query->countQuery()->execute()->fetchField();
public function testRangeUndo() {
$query = $this->connection->select('test');
- $name_field = $query->addField('test', 'name');
- $age_field = $query->addField('test', 'age', 'age');
+ $query->addField('test', 'name');
+ $query->addField('test', 'age', 'age');
$query->range(0, 2);
$query->range(NULL, NULL);
$query_result = $query->countQuery()->execute()->fetchField();| Comment | File | Size | Author |
|---|---|---|---|
| unsused-variable-removed.patch | 791 bytes | hardik_patel_12 |
Comments
Comment #2
siddhant.bhosale commentedComment #3
siddhant.bhosale commentedHi, the patch applies cleanly and the test run without errors. Looks good to be merged.
Comment #4
siddhant.bhosale commentedAs per @kiamlaluno's comment on the similar issue https://www.drupal.org/project/drupal/issues/3158266,
I am changing the status to Needs work.
Comment #5
paulocsSo we can see in the issue #1806606: Drupal\Core\Database\Query\Select::range() doesn't correctly implement SelectInterface that those variables were added there.
It's no problem to remove them as they are not used. Bellow is code that added the variablels:
Cheers,
Paulo
Comment #6
paulocsComment #7
alexpottCommitted and pushed fde0132b02 to 9.1.x and 1345c2113c to 9.0.x and bcc48076e3 to 8.9.x. Thanks!
Comment #11
alexpottBackported to 8.9.x to keep tests aligned.