You are here

protected function PathautoTestHelper::entity_uri in Pathauto 6.2

Same name and namespace in other branches
  1. 6 pathauto.test \PathautoTestHelper::entity_uri()

Backport of Drupal 7's entity_uri() function.

5 calls to PathautoTestHelper::entity_uri()
PathautoTestHelper::assertEntityAlias in ./pathauto.test
PathautoTestHelper::assertEntityAliasExists in ./pathauto.test
PathautoTestHelper::assertNoEntityAlias in ./pathauto.test
PathautoTestHelper::assertNoEntityAliasExists in ./pathauto.test
PathautoTestHelper::saveEntityAlias in ./pathauto.test

File

./pathauto.test, line 87
Functionality tests for Pathauto.

Class

PathautoTestHelper
Helper test class with some added functions for testing.

Code

protected function entity_uri($entity_type, $entity) {
  $uri = array();
  switch ($entity_type) {
    case 'node':
      $uri['path'] = 'node/' . $entity->nid;
      break;
    case 'taxonomy_term':
      $uri['path'] = taxonomy_term_path($entity);
      break;
    case 'user':
      $uri['path'] = 'user/' . $entity->uid;
      break;
    default:
      return $this
        ->fail(t('Unknown entity @type.', array(
        '@type' => $entity_type,
      )));
  }
  return $uri;
}