Issue #3151953 by durgeshs, daffie, snehalgaikwad, Lal_: Replace the database query with an entity query in TermTranslationUITest
parent
05e26348e1
commit
6b587e6399
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Drupal\Tests\taxonomy\Functional;
|
namespace Drupal\Tests\taxonomy\Functional;
|
||||||
|
|
||||||
use Drupal\Core\Database\Database;
|
|
||||||
use Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase;
|
use Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase;
|
||||||
use Drupal\Core\Language\LanguageInterface;
|
use Drupal\Core\Language\LanguageInterface;
|
||||||
use Drupal\taxonomy\Entity\Vocabulary;
|
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
|
// Make sure that no row was inserted for taxonomy vocabularies which do
|
||||||
// not have translations enabled.
|
// 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();
|
$tids = \Drupal::entityQueryAggregate('taxonomy_term')
|
||||||
foreach ($rows as $row) {
|
->aggregate('tid', 'COUNT')
|
||||||
$this->assertTrue($row->count < 2, 'Term does not have translations.');
|
->condition('vid', $this->bundle, '<>')
|
||||||
|
->groupBy('tid')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
foreach ($tids as $tid) {
|
||||||
|
$this->assertTrue($tid['tid_count'] < 2, 'Term does have translations.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue