From 6b587e63991a399d82cba6064a5d2c05d61f879c Mon Sep 17 00:00:00 2001 From: catch Date: Mon, 22 Jun 2020 14:24:48 +0100 Subject: [PATCH] Issue #3151953 by durgeshs, daffie, snehalgaikwad, Lal_: Replace the database query with an entity query in TermTranslationUITest --- .../tests/src/Functional/TermTranslationUITest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php b/core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php index a64a0590f8d2..2aca19e72cfc 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\taxonomy\Functional; -use Drupal\Core\Database\Database; use Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase; use Drupal\Core\Language\LanguageInterface; use Drupal\taxonomy\Entity\Vocabulary; @@ -97,9 +96,14 @@ class TermTranslationUITest extends ContentTranslationUITestBase { // Make sure that no row was inserted for taxonomy vocabularies which do // not have translations enabled. - $rows = Database::getConnection()->query('SELECT tid, count(tid) AS count FROM {taxonomy_term_field_data} WHERE vid <> :vid GROUP BY tid', [':vid' => $this->bundle])->fetchAll(); - foreach ($rows as $row) { - $this->assertTrue($row->count < 2, 'Term does not have translations.'); + $tids = \Drupal::entityQueryAggregate('taxonomy_term') + ->aggregate('tid', 'COUNT') + ->condition('vid', $this->bundle, '<>') + ->groupBy('tid') + ->execute(); + + foreach ($tids as $tid) { + $this->assertTrue($tid['tid_count'] < 2, 'Term does have translations.'); } }