NumberTest
extends DataInterfaceTestAbstract
in package
Tests the Number class
Table of Contents
Constants
- testData = '0123456789'
Properties
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>
- isNumber() should pass on any number and fail on anything else
- 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
testData
protected
mixed
testData
= '0123456789'
Properties
$dataMode
protected
QRDataModeInterface
$dataMode
$QRData
protected
QRData
$QRData
Methods
getMaxLengthForMode()
the maximum character count for the given $mode and $eccLevel
public
static getMaxLengthForMode(int $mode, Version $version, EccLevel $eccLevel) : int
Parameters
Tags
Return values
intmaskPatternProvider()
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
Return values
GeneratorstringValidateProvider()
isNumber() should pass on any number and fail on anything else
public
static stringValidateProvider() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>testBinaryStringInvalid()
Tests if a random binary string is properly validated as false
public
testBinaryStringInvalid() : void
Tags
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
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
testMaxLength()
public
testMaxLength(Version $version, EccLevel $eccLevel, string $str) : void
Parameters
Attributes
- #[DataProvider]
- 'maxLengthProvider'
testMaxLengthOverflowException()
Tests if an exception is thrown on data overflow
public
testMaxLengthOverflowException(Version $version, EccLevel $eccLevel, string $str, string $str1) : void
Parameters
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
Return values
array<string|int, mixed>getDataModeInterface()
protected
static getDataModeInterface(string $data) : QRDataModeInterface
Parameters
- $data : string
Return values
QRDataModeInterfacesetUp()
protected
setUp() : void