public function RandomTest::testRandomNameNonUnique in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Component/Utility/RandomTest.php \Drupal\Tests\Component\Utility\RandomTest::testRandomNameNonUnique()
Tests random name generation if uniqueness is not enforced.
@covers ::name
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ RandomTest.php, line 98 - Contains \Drupal\Tests\Component\Utility\RandomTest.
Class
- RandomTest
- Tests random data generation.
Namespace
Drupal\Tests\Component\UtilityCode
public function testRandomNameNonUnique() {
// There are fewer than 100 possibilities if we were forcing uniqueness so
// exception would occur.
$random = new Random();
for ($i = 0; $i <= 100; $i++) {
$random
->name(1);
}
$this
->assertTrue(TRUE, 'No exception thrown when uniqueness is not enforced.');
}