You are here

public function PathautoTestHelperTrait::drupalGetTermByName in Pathauto 8

1 call to PathautoTestHelperTrait::drupalGetTermByName()
PathautoTaxonomyWebTest::testTermEditing in tests/src/Functional/PathautoTaxonomyWebTest.php
Basic functional testing of Pathauto with taxonomy terms.

File

tests/src/Functional/PathautoTestHelperTrait.php, line 184

Class

PathautoTestHelperTrait
Helper test class with some added functions for testing.

Namespace

Drupal\Tests\pathauto\Functional

Code

public function drupalGetTermByName($name, $reset = FALSE) {
  if ($reset) {

    // @todo - implement cache reset.
  }
  $terms = \Drupal::entityTypeManager()
    ->getStorage('taxonomy_term')
    ->loadByProperties([
    'name' => $name,
  ]);
  return !empty($terms) ? reset($terms) : FALSE;
}