function RandomGeneratorTrait::randomMachineName
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/RandomGeneratorTrait.php \Drupal\Tests\RandomGeneratorTrait::randomMachineName()
- 10 core/tests/Drupal/Tests/RandomGeneratorTrait.php \Drupal\Tests\RandomGeneratorTrait::randomMachineName()
- 9 core/tests/Drupal/Tests/RandomGeneratorTrait.php \Drupal\Tests\RandomGeneratorTrait::randomMachineName()
- 8.9.x core/tests/Drupal/Tests/RandomGeneratorTrait.php \Drupal\Tests\RandomGeneratorTrait::randomMachineName()
Generates a unique random string containing letters and numbers.
Do not use this method when testing non validated user input. Instead, use \Drupal\Tests\RandomGeneratorTrait::randomString().
Parameters
int $length: Length of random string to generate.
Return value
string Randomly generated unique string.
See also
\Drupal\Component\Utility\Random::name()
561 calls to RandomGeneratorTrait::randomMachineName()
- AliasManagerTest::testGetAliasByPathCachedMissLanguage in core/
modules/ path_alias/ tests/ src/ Unit/ AliasManagerTest.php - Tests the getAliasByPath cache when a different language is requested.
- AliasManagerTest::testGetAliasByPathMatch in core/
modules/ path_alias/ tests/ src/ Unit/ AliasManagerTest.php - Tests the getAliasByPath method for a path that has a matching alias.
- AliasManagerTest::testGetAliasByPathNoMatch in core/
modules/ path_alias/ tests/ src/ Unit/ AliasManagerTest.php - Tests the getAliasByPath method for a path that has no matching alias.
- AliasManagerTest::testGetAliasByPathPrefixList in core/
modules/ path_alias/ tests/ src/ Unit/ AliasManagerTest.php - Tests the getAliasByPath method for a path that is not in the prefix list.
- AliasManagerTest::testGetPathByAliasLangcode in core/
modules/ path_alias/ tests/ src/ Unit/ AliasManagerTest.php - Tests the getPathByAlias method when a langcode is passed explicitly.
File
-
core/
tests/ Drupal/ Tests/ RandomGeneratorTrait.php, line 51
Class
- RandomGeneratorTrait
- Provides random generator utility methods.
Namespace
Drupal\TestsCode
protected function randomMachineName($length = 8) : string {
return Random::machineName($length);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.