Closed (fixed)
Project:
Drupal core
Version:
9.1.x-dev
Component:
database system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Jun 2020 at 08:16 UTC
Updated:
6 Jul 2020 at 17:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
daffie commentedThere is something wrong with the test, because the query returns an empty array. See my added patch.
Comment #3
snehalgaikwad commentedI replaced database query with an entity query but tests are failing. Previously database query was returning empty array so foreach wasn't getting executed but after replacing it with entity query now its is returning one value. Count in value is greater than 2 so test case is getting failed. Need to look into test case.
Comment #5
durgeshs commentedComment #6
durgeshs commentedI have checked query and tables for above scenarios and found there are added translation when run testTranslationUI() method. And every time it is giving tid_count = 4;



Please check attached screenshots.
As per code, every time this code would be failed, either we can change code entityQueryAggregate with any other or change number of count under
$this->assertTrue($tid['tid_count'] < 2, 'Term does not have translations.');According to me, tid_count should be greater than 1, because in this scenario we are getting translated terms.
Comment #7
daffie commented@durgeshs: Thank you for working on this. Patch looks good, only I have a few remarks:
There needs to be a space between '=' and '\Drupal'.
This is not the correct condition. The field "vid" should NOT be equal to $this->bundle.
These lines are not correctly indented. Each line needs 2 more spaces.
Can we keep the part "< 2" and also keep the original message.
Comment #8
durgeshs commentedComment #9
durgeshs commentedHi @daffie: Thanks for suggestion to change coding standard.
I have updated all changes except of #4, we can keep "<2" and original message, because at this point term have translated value and we could not get count value lower than 2. If we keep #4, test case will be failed every time.
Comment #10
durgeshs commentedComment #11
durgeshs commentedRemoved Unused use statement.
Comment #12
daffie commentedWith the following changes we change as little as possible and the test passes on my local machine.
Can we change this line to:
->condition('vid', $this->bundle, '<>').Can we change this line to:
$this->assertTrue($tid['tid_count'] < 2, 'Term does not have translations.');.Comment #13
Lal_Comment #14
daffie commentedThe query has been replaced by an entity query.
The code change looks good to me.
For me it is RTBC.
Comment #16
catchCommitted 6b587e6 and pushed to 9.1.x. Thanks!
Comment #17
hardik_patel_12 commentedRelated issues are as follows.
#3151959: Replace the database query with an entity query in PathTaxonomyTermTest
#3151968: Replace the database query with an entity query in NodeTranslationUITest
#3151981: Replace the database query with an entity query in NodeRevisionsAllTest
#3151990: Replace the database queries with an entity queries in NodeRevisionPermissionsTest