function Random::machineName
Same name in this branch
- 10 core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random::machineName()
Same name and namespace in other branches
- 11.x core/tests/Drupal/TestTools/Random.php \Drupal\TestTools\Random::machineName()
- 11.x core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random::machineName()
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()
6 calls to Random::machineName()
- CheckpointStorageTest::writeMethodsProvider in core/
tests/ Drupal/ Tests/ Core/ Config/ Checkpoint/ CheckpointStorageTest.php - Provide the methods that throw an exception.
- ConfigEntityBaseUnitTest::providerCalculateDependenciesWithPluginCollections in core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityBaseUnitTest.php - Data provider for testCalculateDependenciesWithPluginCollections.
- MenuActiveTrailTest::provider in core/
tests/ Drupal/ Tests/ Core/ Menu/ MenuActiveTrailTest.php - Provides test data for all test methods.
- PluralTranslationTest::providerTestGet in core/
tests/ Drupal/ Tests/ Core/ Annotation/ PluralTranslationTest.php - Provides data to self::testGet().
- ReadOnlyStorageTest::writeMethodsProvider in core/
tests/ Drupal/ Tests/ Core/ Config/ ReadOnlyStorageTest.php - Provide the methods that throw an exception.
File
-
core/
tests/ Drupal/ TestTools/ Random.php, line 105
Class
- Random
- Provides random generator utility static methods.
Namespace
Drupal\TestToolsCode
public static function machineName(int $length = 8) : string {
return static::getGenerator()->machineName($length, TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.