You are here

public function PathAliasTest::getPID in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/path/tests/src/Functional/PathAliasTest.php \Drupal\Tests\path\Functional\PathAliasTest::getPID()

Returns the path ID.

Parameters

string $alias: A string containing an aliased path.

Return value

int Integer representing the path ID.

1 call to PathAliasTest::getPID()
PathAliasTest::testAdminAlias in core/modules/path/tests/src/Functional/PathAliasTest.php
Tests alias functionality through the admin interfaces.

File

core/modules/path/tests/src/Functional/PathAliasTest.php, line 387

Class

PathAliasTest
Add, edit, delete, and change alias and verify its consistency in the database.

Namespace

Drupal\Tests\path\Functional

Code

public function getPID($alias) {
  $result = \Drupal::entityTypeManager()
    ->getStorage('path_alias')
    ->getQuery()
    ->condition('alias', $alias, '=')
    ->accessCheck(FALSE)
    ->execute();
  return reset($result);
}