Documentation

AlphaNumTest extends DataInterfaceTestAbstract
in package

FinalYes

Tests the AlphaNum class

Table of Contents

Constants

testData  = '0 $%*+-./:'

Properties

$dataMode  : QRDataModeInterface
$QRData  : QRData

Methods

getMaxLengthForMode()  : int
the maximum character count for the given $mode and $eccLevel
maskPatternProvider()  : array<string|int, array<string|int, int>>
maxLengthProvider()  : Generator
Generates test data for each data mode:
stringValidateProvider()  : array<string|int, mixed>
isAlphaNum() should pass on the 45 defined characters and fail on anything else (e.g. lowercase)
testBinaryStringInvalid()  : void
Tests if a random binary string is properly validated as false
testDecodeSegment()  : void
Tests decoding a data segment from a given BitBuffer
testGetMinimumVersion()  : void
Tests getting the minimum QR version for the given data
testGetMinimumVersionException()  : void
Tests if an exception is thrown when the data exceeds the maximum version while auto-detecting
testInitMatrix()  : void
Tests initializing the data matrix
testInvalidDataException()  : void
Tests if an exception is thrown when an invalid character is encountered
testInvalidDataOnEmptyException()  : void
Tests if an exception is thrown if the given string is empty
testMaxLength()  : void
testMaxLengthOverflowException()  : void
Tests if an exception is thrown on data overflow
testValidateString()  : void
Tests if a string is properly validated for the respective data mode
versionBreakpointProvider()  : array<string|int, mixed>
returns versions within the version breakpoints 1-9, 10-26 and 27-40
getDataModeInterface()  : QRDataModeInterface
setUp()  : void

Constants

Properties

Methods

getMaxLengthForMode()

the maximum character count for the given $mode and $eccLevel

public static getMaxLengthForMode(int $mode, Version $version, EccLevel $eccLevel) : int
Parameters
$mode : int
$version : Version
$eccLevel : EccLevel
Tags
throws
QRCodeException
codeCoverageIgnore
Return values
int

maskPatternProvider()

public static maskPatternProvider() : array<string|int, array<string|int, int>>
Return values
array<string|int, array<string|int, int>>

maxLengthProvider()

Generates test data for each data mode:

public static maxLengthProvider() : Generator
  • version
  • ECC level
  • a string that contains the maximum amount of characters for the given mode
  • a string that contains characters for the given mode and that exceeds the maximum length by one/two character(s)
  • the maximum allowed character length
Tags
throws
Exception
Return values
Generator

stringValidateProvider()

isAlphaNum() should pass on the 45 defined characters and fail on anything else (e.g. lowercase)

public static stringValidateProvider() : array<string|int, mixed>
Tags
phpstan-return

array<int, array{0: string, 1: bool}>

Return values
array<string|int, mixed>

testDecodeSegment()

Tests decoding a data segment from a given BitBuffer

public testDecodeSegment(int $version) : void
Parameters
$version : int
Attributes
#[DataProvider]
'versionBreakpointProvider'

testGetMinimumVersion()

Tests getting the minimum QR version for the given data

public testGetMinimumVersion(Version $version, EccLevel $eccLevel, string $str) : void
Parameters
$version : Version
$eccLevel : EccLevel
$str : string
Attributes
#[DataProvider]
'maxLengthProvider'

testGetMinimumVersionException()

Tests if an exception is thrown when the data exceeds the maximum version while auto-detecting

public testGetMinimumVersionException() : void

testInitMatrix()

Tests initializing the data matrix

public testInitMatrix(int $pattern) : void
Parameters
$pattern : int
Attributes
#[DataProvider]
'maskPatternProvider'

testInvalidDataException()

Tests if an exception is thrown when an invalid character is encountered

public testInvalidDataException() : void

testInvalidDataOnEmptyException()

Tests if an exception is thrown if the given string is empty

public testInvalidDataOnEmptyException() : void

testMaxLengthOverflowException()

Tests if an exception is thrown on data overflow

public testMaxLengthOverflowException(Version $version, EccLevel $eccLevel, string $str, string $str1) : void
Parameters
$version : Version
$eccLevel : EccLevel
$str : string
$str1 : string
Attributes
#[DataProvider]
'maxLengthProvider'

testValidateString()

Tests if a string is properly validated for the respective data mode

public testValidateString(string $string, bool $expected) : void
Parameters
$string : string
$expected : bool
Attributes
#[DataProvider]
'stringValidateProvider'

versionBreakpointProvider()

returns versions within the version breakpoints 1-9, 10-26 and 27-40

public static versionBreakpointProvider() : array<string|int, mixed>
Tags
phpstan-return

array<string, array{0: int}>

Return values
array<string|int, mixed>

        
On this page

Search results