PHP Class kahlan\matcher\ToThrow

Datei anzeigen Open project: crysalead/kahlan Class Usage Examples

Public Properties

Property Type Description
$_description array Description reference of the last ::match() call.

Public Methods

Method Description
_buildDescription ( object $actual, object $expected ) Build the description of the runned ::match() call.
_matchException ( object $actual, $exception ) : boolean Compares if two exception are similar.
_sameMessage ( string $actual, string $expected ) : boolean Compare if exception messages are similar.
actual ( mixed $actual ) : mixed Normalise the actual value as an Exception.
description ( ) Returns the description report.
expected ( mixed $expected, integer $code ) : mixed Normalise the expected value as an Exception.
match ( Closure $actual, mixed $expected = null, integer $code ) : boolean Checks that $actual throws the $expected exception.

Method Details

_buildDescription() public static method

Build the description of the runned ::match() call.
public static _buildDescription ( object $actual, object $expected )
$actual object The actual exception instance.
$expected object The expected exception instance.

_matchException() public static method

Compares if two exception are similar.
public static _matchException ( object $actual, $exception ) : boolean
$actual object The actual instance.
return boolean

_sameMessage() public static method

Compare if exception messages are similar.
public static _sameMessage ( string $actual, string $expected ) : boolean
$actual string The actual message.
$expected string The expected message.
return boolean

actual() public static method

Normalise the actual value as an Exception.
public static actual ( mixed $actual ) : mixed
$actual mixed The actual value to be normalized.
return mixed The normalised value.

description() public static method

Returns the description report.
public static description ( )

expected() public static method

Normalise the expected value as an Exception.
public static expected ( mixed $expected, integer $code ) : mixed
$expected mixed The expected value to be normalized.
$code integer The expected `Exception` code if `$expected` is a string.
return mixed The normalised value.

match() public static method

The value passed to $expected is either an exception or the expected exception's message.
public static match ( Closure $actual, mixed $expected = null, integer $code ) : boolean
$actual Closure The closure to run.
$expected mixed A string indicating what the error text is expected to be or a exception instance.
$code integer The expected `Exception` code if `$expected` is a string.
return boolean

Property Details

$_description public_oe static_oe property

Description reference of the last ::match() call.
public static array $_description
return array