You are here

protected function TaxonomyTermUpdatePathTest::assertTermName in Drupal 8

Assert that a term name matches the expectation.

Parameters

string $id: The term ID.

string $expected_name: The expected term name.

1 call to TaxonomyTermUpdatePathTest::assertTermName()
TaxonomyTermUpdatePathTest::testConversionToRevisionable in core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php
Tests the conversion of taxonomy terms to be revisionable.

File

core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php, line 246

Class

TaxonomyTermUpdatePathTest
Tests the upgrade path for taxonomy terms.

Namespace

Drupal\Tests\taxonomy\Functional\Update

Code

protected function assertTermName($id, $expected_name) {
  $database = \Drupal::database();
  $query = $database
    ->select('taxonomy_term_field_data', 'd');
  $query
    ->join('taxonomy_term_data', 't', 't.tid = d.tid AND d.default_langcode = 1');
  $name = $query
    ->fields('d', [
    'name',
  ])
    ->condition('d.tid', $id)
    ->execute()
    ->fetchField();
  $this
    ->assertSame($expected_name, $name ?: '');
}