You are here

public function PathautoTestHelperTrait::saveEntityAlias in Pathauto 8

2 calls to PathautoTestHelperTrait::saveEntityAlias()
PathautoKernelTest::testPathTokens in tests/src/Kernel/PathautoKernelTest.php
Test the handling of path vs non-path tokens in pathauto_clean_token_values().
PathautoLocaleTest::testLanguageAliases in tests/src/FunctionalJavascript/PathautoLocaleTest.php
Test that when an English node is updated, its old English alias is updated and its newer French alias is left intact.

File

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

Class

PathautoTestHelperTrait
Helper test class with some added functions for testing.

Namespace

Drupal\Tests\pathauto\Functional

Code

public function saveEntityAlias(EntityInterface $entity, $alias, $langcode = NULL) {

  // By default, use the entity language.
  if (!$langcode) {
    $langcode = $entity
      ->language()
      ->getId();
  }
  return $this
    ->createPathAlias('/' . $entity
    ->toUrl()
    ->getInternalPath(), $alias, $langcode);
}