protected function RandomGeneratorTrait::randomMachineName in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/RandomGeneratorTrait.php \Drupal\simpletest\RandomGeneratorTrait::randomMachineName()
Generates a unique random string containing letters and numbers.
Do not use this method when testing unvalidated user input. Instead, use \Drupal\simpletest\TestBase::randomString().
Parameters
int $length: Length of random string to generate.
Return value
string Randomly generated unique string.
See also
\Drupal\Component\Utility\Random::name()
743 calls to RandomGeneratorTrait::randomMachineName()
- ActionUnitTest::testOperations in core/
modules/ system/ src/ Tests/ Action/ ActionUnitTest.php - Tests the functionality of test actions.
- AddFeedTest::testBasicFeedAddNoTitle in core/
modules/ system/ src/ Tests/ Common/ AddFeedTest.php - Tests attaching feeds with paths, URLs, and titles.
- AggregatorTestBase::createSampleNodes in core/
modules/ aggregator/ src/ Tests/ AggregatorTestBase.php - Creates sample article nodes.
- AggregatorTestBase::getFeedEditArray in core/
modules/ aggregator/ src/ Tests/ AggregatorTestBase.php - Returns a randomly generated feed edit array.
- AggregatorTestBase::getFeedEditObject in core/
modules/ aggregator/ src/ Tests/ AggregatorTestBase.php - Returns a randomly generated feed edit object.
File
- core/
modules/ simpletest/ src/ RandomGeneratorTrait.php, line 98 - Contains \Drupal\simpletest\RandomGeneratorTrait.
Class
- RandomGeneratorTrait
- Provides random generator utility methods.
Namespace
Drupal\simpletestCode
protected function randomMachineName($length = 8) {
return $this
->getRandomGenerator()
->name($length, TRUE);
}