Methods summary
public static
|
#
same( mixed $expected, mixed $actual )
Checks assertion. Values must be exactly the same.
Checks assertion. Values must be exactly the same.
|
public static
|
#
notSame( mixed $expected, mixed $actual )
Checks assertion. Values must not be exactly the same.
Checks assertion. Values must not be exactly the same.
|
public static
|
#
equal( mixed $expected, mixed $actual )
Checks assertion. The identity of objects and the order of keys in the arrays
are ignored.
Checks assertion. The identity of objects and the order of keys in the arrays
are ignored.
|
public static
|
#
notEqual( mixed $expected, mixed $actual )
Checks assertion. The identity of objects and the order of keys in the arrays
are ignored.
Checks assertion. The identity of objects and the order of keys in the arrays
are ignored.
|
public static
|
#
contains( mixed $needle, mixed $actual )
Checks assertion. Values must contains expected needle.
Checks assertion. Values must contains expected needle.
|
public static
|
#
notContains( mixed $needle, mixed $actual )
Checks assertion. Values must not contains expected needle.
Checks assertion. Values must not contains expected needle.
|
public static
|
#
true( mixed $actual )
Checks TRUE assertion.
Parameters
|
public static
|
#
false( mixed $actual )
Checks FALSE assertion.
Parameters
|
public static
|
#
null( mixed $actual )
Checks NULL assertion.
Parameters
|
public static
|
#
truthy( mixed $actual )
Checks truthy assertion.
Parameters
|
public static
|
#
falsey( mixed $actual )
Checks falsey (empty) assertion.
Checks falsey (empty) assertion.
Parameters
|
public static
|
#
type( mixed $type, mixed $value )
|
public static
Exception
|
#
exception( callable $function, string $class, string $message = NULL )
Checks if the function throws exception.
Checks if the function throws exception.
Parameters
- $function
callable
- $class
string class
- $message
string message
Returns
|
public static
Exception
|
#
throws( mixed $function, mixed $class, mixed $message = NULL )
Checks if the function throws exception, alias for exception().
Checks if the function throws exception, alias for exception().
Returns
|
public static
null|Exception
|
#
error( callable $function, integer|string|array $expectedType, string $expectedMessage = NULL )
Checks if the function generates PHP error or throws exception.
Checks if the function generates PHP error or throws exception.
Parameters
- $function
callable
- $expectedType
integer|string|array
- $expectedMessage
string message
Returns
|
public static
|
#
match( string $pattern, string $actual )
Compares result using regular expression or mask:
%a% one or more of anything except the end of line characters
%a?% zero or more of anything except the end of line characters
%A% one or more of anything including the end of line characters
%A?% zero or more of anything including the end of line characters
%s% one or more white space characters except the end of line characters
%s?% zero or more white space characters except the end of line characters
%S% one or more of characters except the white space
%S?% zero or more of characters except the white space
%c% a single character of any sort (except the end of line)
%d% one or more digits
%d?% zero or more digits
%i% signed integer value
%f% floating point number
%h% one or more HEX digits
Compares result using regular expression or mask: %a% one or more of anything
except the end of line characters %a?% zero or more of anything except the end
of line characters %A% one or more of anything including the end of line
characters %A?% zero or more of anything including the end of line characters
%s% one or more white space characters except the end of line characters %s?%
zero or more white space characters except the end of line characters %S% one or
more of characters except the white space %S?% zero or more of characters except
the white space %c% a single character of any sort (except the end of line) %d%
one or more digits %d?% zero or more digits %i% signed integer value %f%
floating point number %h% one or more HEX digits
Parameters
- $pattern
string mask|regexp; only delimiters ~ and # are supported for regexp
- $actual
string
|
public static
|
#
matchFile( mixed $file, mixed $actual )
Compares results using mask sorted in file.
Compares results using mask sorted in file.
|
public static
|
#
fail( mixed $message, mixed $actual = NULL, mixed $expected = NULL )
|
public static
|
|
Properties summary
public static
array
|
$patterns
|
array(
'%a%' => '[^\r\n]+',
'%a\?%'=> '[^\r\n]*',
'%A%' => '.+',
'%A\?%'=> '.*',
'%s%' => '[\t ]+',
'%s\?%'=> '[\t ]*',
'%S%' => '\S+',
'%S\?%'=> '\S*',
'%c%' => '[^\r\n]',
'%d%' => '[0-9]+',
'%d\?%'=> '[0-9]*',
'%i%' => '[+-]?[0-9]+',
'%f%' => '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?',
'%h%' => '[0-9a-fA-F]+',
'%ds%'=> '[\\\\/]',
'%(\[.*\].*)%'=> '$1',
) |
#
used by match(); in values, each $ followed by number is backreference
used by match(); in values, each $ followed by number is backreference
|
public static
callable
|
$onFailure
|
|
#
function(AssertException $exception)
function(AssertException $exception)
|