protected function ReferenceSourceTest::findCharacterNotInString in FileField Sources 8
Find the first character that is not in string.
Only find for lower case character.
Parameters
string $string: String to check.
Return value
string First character that is not in the string.
1 call to ReferenceSourceTest::findCharacterNotInString()
- ReferenceSourceTest::testAutocompletion in tests/
src/ Functional/ ReferenceSourceTest.php - Test autocompletion.
File
- tests/
src/ Functional/ ReferenceSourceTest.php, line 100
Class
- ReferenceSourceTest
- Tests the reference source.
Namespace
Drupal\Tests\filefield_sources\FunctionalCode
protected function findCharacterNotInString($string) {
// Only check for lower case string.
$string = mb_strtolower($string);
// Lower case characters and numbers generated by
// \Drupal\simpletest\TestBase::randomMachineName().
$values = array_merge(range(97, 122), range(48, 57));
foreach ($values as $value) {
$character = chr($value);
if (strpos($string, $character) === FALSE) {
return $character;
}
}
}