function Random::machineName
Same name in this branch
- 10 core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random::machineName()
Same name 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()
18 calls to Random::machineName()
- ArgumentTransformTermTest::termArgumentTransformationProvider in core/
modules/ taxonomy/ tests/ src/ Kernel/ Views/ ArgumentTransformTermTest.php - Provides data for testTermArgumentTransformation().
- BigPipeResponseAttachmentsProcessorTest::attachmentsProvider in core/
modules/ big_pipe/ tests/ src/ Unit/ Render/ BigPipeResponseAttachmentsProcessorTest.php - BlockPluginHasSettingsTrayFormAccessCheckTest::providerTestAccess in core/
modules/ settings_tray/ tests/ src/ Unit/ Access/ BlockPluginHasSettingsTrayFormAccessCheckTest.php - Provides test data for ::testAccess().
- CheckpointStorageTest::writeMethodsProvider in core/
tests/ Drupal/ Tests/ Core/ Config/ Checkpoint/ CheckpointStorageTest.php - Provide the methods that throw an exception.
- CKEditor5PluginManagerTest::providerProvidedElementsInvalidElementSubset in core/
modules/ ckeditor5/ tests/ src/ Kernel/ CKEditor5PluginManagerTest.php - Data provider.
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.