function PathAliasTest::getPID

Same name in other branches
  1. 9 core/modules/path/tests/src/Functional/PathAliasTest.php \Drupal\Tests\path\Functional\PathAliasTest::getPID()
  2. 8.9.x core/modules/path/tests/src/Functional/PathAliasTest.php \Drupal\Tests\path\Functional\PathAliasTest::getPID()
  3. 11.x 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 412

Class

PathAliasTest
Tests modifying path aliases from the UI.

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.