You are here

protected function TaxonomyTermFormTest::getTermByName in URL Alias Permissions 8

Find a term by name.

Parameters

string $name: The taxonomy term name.

string $vocabulary_id: The vocabulary ID.

bool $reset: (optional) Whether to reset the entity cache.

Return value

\Drupal\Core\Entity\EntityInterface|false The term entity when found, else NULL.

1 call to TaxonomyTermFormTest::getTermByName()
TaxonomyTermFormTest::testPathAliasFormElementAccess in tests/src/Functional/TaxonomyTermFormTest.php
Test if the path alias form elements is correctly hidden when no access.

File

tests/src/Functional/TaxonomyTermFormTest.php, line 135

Class

TaxonomyTermFormTest
Test url_alias_permissions with taxonomy terms.

Namespace

Drupal\Tests\url_alias_permissions\Functional

Code

protected function getTermByName(string $name, string $vocabulary_id, bool $reset = FALSE) {
  if ($reset === TRUE) {
    $this->taxonomyTermStorage
      ->resetCache();
  }
  $terms = $this->taxonomyTermStorage
    ->loadByProperties([
    'name' => trim($name),
    'vid' => $vocabulary_id,
  ]);
  return current($terms);
}