function RandomTest::testRandomMachineNameNonUnique
Same name in other branches
- 10 core/tests/Drupal/Tests/Component/Utility/RandomTest.php \Drupal\Tests\Component\Utility\RandomTest::testRandomMachineNameNonUnique()
Tests random name generation if uniqueness is not enforced.
@covers ::machineName
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ RandomTest.php, line 155
Class
- RandomTest
- Tests random data generation.
Namespace
Drupal\Tests\Component\UtilityCode
public function testRandomMachineNameNonUnique() : void {
// There are fewer than 100 possibilities meaning if uniqueness was
// enforced, there would be an exception.
$random = new Random();
for ($i = 0; $i <= 100; $i++) {
$random->machineName(1);
}
$this->expectNotToPerformAssertions();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.