protected function TrackChangesTest::termExists in Drupal 9
Same name and namespace in other branches
- 8 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
2 calls to TrackChangesTest::termExists()
- TrackChangesTest::assertTermDoesNotExist in core/
modules/ migrate/ tests/ src/ Kernel/ TrackChangesTest.php - Assert that term with given title does not exist.
- TrackChangesTest::assertTermExists in core/
modules/ migrate/ tests/ src/ Kernel/ TrackChangesTest.php - Assert that term with given name exists.
File
- core/
modules/ migrate/ tests/ src/ Kernel/ TrackChangesTest.php, line 183
Class
- TrackChangesTest
- Tests migration track changes property.
Namespace
Drupal\Tests\migrate\KernelCode
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);
}