You are here

protected function TrackChangesTest::termExists in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Kernel/TrackChangesTest.php \Drupal\Tests\migrate\Kernel\TrackChangesTest::termExists()
  2. 9 core/modules/migrate/tests/src/Kernel/TrackChangesTest.php \Drupal\Tests\migrate\Kernel\TrackChangesTest::termExists()

Checks if term with given name exists.

Parameters

string $property: Property to evaluate.

string $value: Value to evaluate.

Return value

bool

File

core/modules/migrate/tests/src/Kernel/TrackChangesTest.php, line 227

Class

TrackChangesTest
Tests migration track changes property.

Namespace

Drupal\Tests\migrate\Kernel

Code

protected function termExists($property, $value) {
  $property = $property === 'description' ? 'description__value' : $property;
  $query = \Drupal::entityQuery('taxonomy_term')
    ->accessCheck(FALSE);
  $result = $query
    ->condition($property, $value)
    ->range(0, 1)
    ->execute();
  return !empty($result);
}