classRandomCharacters
final class RandomCharacters
Draws a fixed number of bytes from a caller-supplied alphabet using Faker. Contains no identifier, literal, quoting or database rules.
Methods§
public function __construct(private Generator $faker)Parameters
$faker | Generator | Source of every choice a draw makes |
Test cases 5
RandomCharactersTest::testCharacterDrawsOneOfTheAlphabetcoversRandomCharactersTest::testStringDrawsAsManyCharactersAsWereAskedForcoversRandomCharactersTest::testStringDrawsNothingWhenNoCharactersWereAskedForcoversRandomCharactersTest::testStringDrawsOnlyFromTheAlphabetItWasGivencoversRandomCharactersTest::testStringIsRepeatableFromOneSeedcovers
public function string(string $alphabet, int $length): stringDraws a string of a given length from an alphabet.
Parameters
$alphabet | string | Characters that may appear |
$length | int | How many characters to draw |
Returns
string String of that length, empty when no characters were asked forTest cases 4
RandomCharactersTest::testStringDrawsAsManyCharactersAsWereAskedForcovers and callsRandomCharactersTest::testStringDrawsNothingWhenNoCharactersWereAskedForcovers and callsRandomCharactersTest::testStringDrawsOnlyFromTheAlphabetItWasGivencovers and callsRandomCharactersTest::testStringIsRepeatableFromOneSeedcovers and calls
Called from 12
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:49
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::mixedAlnumString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:57
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::hexString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:75
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::binaryString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:83
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::hostnameString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:115
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::unsignedBigIntString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:133
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:46
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::mixedAlnumString() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:54
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::hexString() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:72
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::binaryString() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:80
- method-call SqlFaker\Sqlite\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/Sqlite/Generation/Value/LiteralGenerator.php:44
- method-call SqlFaker\Sqlite\Generation\Value\LiteralGenerator::mixedAlnumString() packages/sql-faker/src/Sqlite/Generation/Value/LiteralGenerator.php:52
Calls 1
- method-call RandomCharacters::character() line 34
public function character(string $alphabet): stringDraws one character from an alphabet.
Parameters
$alphabet | string | Characters that may appear |
Returns
string One of themTest cases 4
Called from 4
- method-call SqlFaker\Generation\Value\RandomCharacters::string() packages/sql-faker/src/Generation/Value/RandomCharacters.php:34
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:48
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:45
- method-call SqlFaker\Sqlite\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/Sqlite/Generation/Value/LiteralGenerator.php:43
Private surface 1§
Implementation details, listed for orientation only.
private Generator $fakerTest cases 19§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
RandomCharactersTest::testCharacterDrawsOneOfTheAlphabetcovers and callsRandomCharactersTest::testStringDrawsAsManyCharactersAsWereAskedForcovers and callsRandomCharactersTest::testStringDrawsNothingWhenNoCharactersWereAskedForcovers and callsRandomCharactersTest::testStringDrawsOnlyFromTheAlphabetItWasGivencovers and callsRandomCharactersTest::testStringIsRepeatableFromOneSeedcovers and calls
Other tests reaching this symbol 14
LexicalExceptionTestcallsGenerationContextTestcallsLexicalGrammarTestcallsLiteralGeneratorTestcallsMySqlProviderTestcallsGenerationContextTestcallsLexicalGrammarTestcallsLiteralGeneratorTestcallsPostgreSqlProviderTestcallsSqlGeneratorFactoryTestcallsGenerationContextTestcallsLexicalGrammarTestcallsLiteralGeneratorTestcallsSqliteProviderTestcalls
Relations§
Instantiated in 3
- new SqlFaker\MySql\Generation\Value\LiteralGenerator::__construct() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:38
- new SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::__construct() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:35
- new SqlFaker\Sqlite\Generation\Value\LiteralGenerator::__construct() packages/sql-faker/src/Sqlite/Generation/Value/LiteralGenerator.php:33
Method calls 15
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:48
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:49
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::mixedAlnumString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:57
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::hexString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:75
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::binaryString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:83
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::hostnameString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:115
- method-call SqlFaker\MySql\Generation\Value\LiteralGenerator::unsignedBigIntString() packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:133
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:45
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:46
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::mixedAlnumString() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:54
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::hexString() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:72
- method-call SqlFaker\PostgreSql\Generation\Value\LiteralGenerator::binaryString() packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:80
- method-call SqlFaker\Sqlite\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/Sqlite/Generation/Value/LiteralGenerator.php:43
- method-call SqlFaker\Sqlite\Generation\Value\LiteralGenerator::rawIdentifier() packages/sql-faker/src/Sqlite/Generation/Value/LiteralGenerator.php:44
- method-call SqlFaker\Sqlite\Generation\Value\LiteralGenerator::mixedAlnumString() packages/sql-faker/src/Sqlite/Generation/Value/LiteralGenerator.php:52
Type declarations 3
- type SqlFaker\MySql\Generation\Value\LiteralGenerator packages/sql-faker/src/MySql/Generation/Value/LiteralGenerator.php:30
- type SqlFaker\PostgreSql\Generation\Value\LiteralGenerator packages/sql-faker/src/PostgreSql/Generation/Value/LiteralGenerator.php:27
- type SqlFaker\Sqlite\Generation\Value\LiteralGenerator packages/sql-faker/src/Sqlite/Generation/Value/LiteralGenerator.php:25