You are here

public function PathautoTestHelperTrait::addTerm in Pathauto 8

3 calls to PathautoTestHelperTrait::addTerm()
PathautoKernelTest::testPathTokens in tests/src/Kernel/PathautoKernelTest.php
Test the handling of path vs non-path tokens in pathauto_clean_token_values().
PathautoKernelTest::testProgrammaticEntityCreation in tests/src/Kernel/PathautoKernelTest.php
Test programmatic entity creation for aliases.
PathautoMassDeleteTest::generateAliases in tests/src/Functional/PathautoMassDeleteTest.php
Helper function to generate aliases.

File

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

Class

PathautoTestHelperTrait
Helper test class with some added functions for testing.

Namespace

Drupal\Tests\pathauto\Functional

Code

public function addTerm(VocabularyInterface $vocabulary, array $values = []) {
  $values += [
    'name' => mb_strtolower($this
      ->randomMachineName(5)),
    'vid' => $vocabulary
      ->id(),
  ];
  $term = Term::create($values);
  $term
    ->save();
  return $term;
}