classLiteralGenerator
final class LiteralGenerator
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Generates Sqlite literal bodies for the bounded lexical API.
Owns the alphabets and numeric formatting used by this dialect.
Methods§
public function __construct(Generator $faker)Parameters
$faker | Generator | Source of every choice the generated strings make |
Calls 1
public function rawIdentifier(int $minLength = 1, int $maxLength = 12): stringGenerate a raw SQL identifier (starts with letter or underscore, followed by alphanumeric/underscore).
Parameters
$minLength | int | |
$maxLength | int |
Returns
stringTest cases 4
Called from 1
Calls 6
- method-call
Generator::numberBetween()line 41 - function-call
maxline 41 - method-call RandomCharacters::character() line 43
- class-const LiteralGenerator::ALPHA_UNDERSCORE() line 43
- method-call RandomCharacters::string() line 44
- class-const LiteralGenerator::ALNUM_UNDERSCORE() line 44
public function mixedAlnumString(int $minLength = 1, int $maxLength = 24): stringGenerate a random string from the mixed alphanumeric+underscore alphabet.
Parameters
$minLength | int | |
$maxLength | int |
Returns
stringTest cases 4
Called from 1
Calls 3
- method-call RandomCharacters::string() line 52
- class-const LiteralGenerator::MIXED_ALNUM_UNDERSCORE() line 52
- method-call
Generator::numberBetween()line 52
public function integerString(int $min = 1, int $max = 9999999999): non-empty-stringGenerate a random integer literal string.
Parameters
$min | int | |
$max | int |
Returns
non-empty-stringTest cases 4
Called from 1
Calls 1
- method-call
Generator::numberBetween()line 62
public function decimalString(int $precision = 13, int $scale = 6): non-empty-stringGenerate a random decimal literal string.
Parameters
$precision | int | |
$scale | int |
Returns
non-empty-stringTest cases 7
LiteralGeneratorTest::testDecimalStringCustomPrecisioncallsLiteralGeneratorTest::testDecimalStringDefaultMatchesExplicitcallsLiteralGeneratorTest::testDecimalStringFormatcallsLiteralGeneratorTest::testDecimalStringFracDigitsMatchScalecallsLiteralGeneratorTest::testDecimalStringPrecisionLimitsIntPartDigitscallsLiteralGeneratorTest::testDecimalStringWithEqualPrecisionAndScalecallsLiteralGeneratorTest::testDecimalStringWithScaleOneHasTwoFracDigitscalls
Called from 1
Private surface 5§
Implementation details, listed for orientation only.
private const ALPHA_UNDERSCORE = 'abcdefghijklmnopqrstuvwxyz_'private const ALNUM_UNDERSCORE = 'abcdefghijklmnopqrstuvwxyz0123456789_'private const MIXED_ALNUM_UNDERSCORE = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'private Generator $fakerprivate RandomCharacters $charactersTest cases 24§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 19
LiteralGeneratorTest::testDecimalStringCustomPrecisioncallsLiteralGeneratorTest::testDecimalStringDefaultMatchesExplicitcallsLiteralGeneratorTest::testDecimalStringFormatcallsLiteralGeneratorTest::testDecimalStringFracDigitsMatchScalecallsLiteralGeneratorTest::testDecimalStringPrecisionLimitsIntPartDigitscallsLiteralGeneratorTest::testDecimalStringWithEqualPrecisionAndScalecallsLiteralGeneratorTest::testDecimalStringWithScaleOneHasTwoFracDigitscallsLiteralGeneratorTest::testIntegerStringCustomRangecallsLiteralGeneratorTest::testIntegerStringDefaultMatchesExplicitcallsLiteralGeneratorTest::testIntegerStringDigitCountRangecallsLiteralGeneratorTest::testIntegerStringFormatcallsLiteralGeneratorTest::testMixedAlnumStringCharacterSetcallsLiteralGeneratorTest::testMixedAlnumStringCustomLengthcallsLiteralGeneratorTest::testMixedAlnumStringDefaultMatchesExplicitcallsLiteralGeneratorTest::testMixedAlnumStringLengthRangecallsLiteralGeneratorTest::testRawIdentifierCustomLengthcallsLiteralGeneratorTest::testRawIdentifierDefaultMatchesExplicitcallsLiteralGeneratorTest::testRawIdentifierLengthRangecallsLiteralGeneratorTest::testRawIdentifierStartsWithLetterOrUnderscorecalls
Other tests reaching this symbol 5
LexicalExceptionTestcallsGenerationContextTestcallsLexicalGrammarTestcallsSqlGeneratorFactoryTestcallsSqliteProviderTestcalls
Relations§
Instantiated in 1
Method calls 4
- method-call SqlFaker\Sqlite\Generation\LexicalGrammar::generateQuotedIdentifier() packages/sql-faker/src/Sqlite/Generation/LexicalGrammar.php:148
- method-call SqlFaker\Sqlite\Generation\LexicalGrammar::generateStringLiteral() packages/sql-faker/src/Sqlite/Generation/LexicalGrammar.php:161
- method-call SqlFaker\Sqlite\Generation\LexicalGrammar::generateIntegerLiteral() packages/sql-faker/src/Sqlite/Generation/LexicalGrammar.php:174
- method-call SqlFaker\Sqlite\Generation\LexicalGrammar::generateDecimalLiteral() packages/sql-faker/src/Sqlite/Generation/LexicalGrammar.php:187