function RandomTest::_RandomStringValidate
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/RandomTest.php \Drupal\Tests\Component\Utility\RandomTest::_RandomStringValidate()
- 8.9.x core/tests/Drupal/Tests/Component/Utility/RandomTest.php \Drupal\Tests\Component\Utility\RandomTest::_RandomStringValidate()
- 10 core/tests/Drupal/Tests/Component/Utility/RandomTest.php \Drupal\Tests\Component\Utility\RandomTest::_RandomStringValidate()
Callback for random string validation.
Parameters
string $string: The random string to validate.
Return value
bool TRUE if the random string is valid, FALSE if not.
See also
\Drupal\Component\Utility\Random::name()
\Drupal\Tests\Component\Utility\RandomTest::testRandomStringValidator()
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ RandomTest.php, line 214
Class
- RandomTest
- Tests random data generation.
Namespace
Drupal\Tests\Component\UtilityCode
public function _RandomStringValidate($string) {
// Return FALSE for the first generated string and any string that is the
// same, as the test expects a different string to be returned.
if (empty($this->firstStringGenerated) || $string == $this->firstStringGenerated) {
$this->firstStringGenerated = $string;
return FALSE;
}
return TRUE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.