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()
- 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 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()
251 calls to RandomGeneratorTrait::randomMachineName()
- BlockContentTestBase::createBlockContent in core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentTestBase.php - Creates a custom block.
- BlockContentTestBase::createBlockContentType in core/
modules/ block_content/ tests/ src/ Functional/ Views/ BlockContentTestBase.php - Creates a custom block type (bundle).
- BlockHookOperationTest::testBlockOperationAlter in core/
modules/ block/ tests/ src/ Functional/ BlockHookOperationTest.php - Tests the block list to see if the test_operation link is added.
- BlockTest::testAddBlockFromLibraryWithWeight in core/
modules/ block/ tests/ src/ Functional/ BlockTest.php - Tests adding a block from the library page with a weight query string.
- BlockTest::testBlock in core/
modules/ block/ tests/ src/ Functional/ BlockTest.php - Tests configuring and moving a module-define block to specific regions.
File
-
core/
tests/ Drupal/ Tests/ RandomGeneratorTrait.php, line 92
Class
- RandomGeneratorTrait
- Provides random generator utility methods.
Namespace
Drupal\TestsCode
protected function randomMachineName($length = 8) {
return $this->getRandomGenerator()
->name($length, TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.