function RandomGeneratorTrait::randomMachineName
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/RandomGeneratorTrait.php \Drupal\Tests\RandomGeneratorTrait::randomMachineName()
- 8.9.x core/tests/Drupal/Tests/RandomGeneratorTrait.php \Drupal\Tests\RandomGeneratorTrait::randomMachineName()
- 11.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()
249 calls to RandomGeneratorTrait::randomMachineName()
- AreaTest::testRenderArea in core/
modules/ views/ tests/ src/ Kernel/ Handler/ AreaTest.php - Tests the rendering of an area.
- ArgumentSummaryTest::createTag in core/
modules/ views/ tests/ src/ Kernel/ Handler/ ArgumentSummaryTest.php - Creates a term in the tag vocabulary.
- AssertMailTraitTest::testAssertMailTrait in core/
tests/ Drupal/ KernelTests/ Core/ Test/ AssertMailTraitTest.php - Tests that the maintenance theme initializes the theme and its base themes.
- AttributeTest::testPrint in core/
tests/ Drupal/ Tests/ Core/ Template/ AttributeTest.php - Tests printing of an attribute.
- AuthenticationCollectorTest::testAuthenticationCollector in core/
tests/ Drupal/ Tests/ Core/ Authentication/ AuthenticationCollectorTest.php - Tests adding, getting, and order of priorities.
File
-
core/
tests/ Drupal/ Tests/ RandomGeneratorTrait.php, line 72
Class
- RandomGeneratorTrait
- Provides random generator utility methods.
Namespace
Drupal\TestsCode
protected function randomMachineName($length = 8) {
return Random::machineName($length);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.