PHP Class kahlan\matcher\ToReceive

Mostrar archivo Open project: crysalead/kahlan Class Usage Examples

Protected Properties

Property Type Description
$_backtrace array The expectation backtrace reference.
$_description array The description report.
$_expected array The expected method method name to be called.
$_messages object The messages instance.
$_ordered boolean If true, will take the calling order into account.
$_report array The report.
$_times integer Number of occurences to match.

Public Methods

Method Description
__construct ( string | object $actual, string $expected ) Constructor
__get ( $name ) Magic getter, if called with 'ordered' will set ordered to true.
_buildDescription ( mixed $startIndex ) Build the description of the runned ::match() call.
backtrace ( ) : object Gets the backtrace reference.
description ( ) Returns the description report.
match ( mixed $actual, mixed $expected = null ) : boolean Checks that $actual receive the $expected message.
once ( ) : self Sets the number of occurences.
resolve ( ) : boolean Resolves the matching.
times ( integer $times = null ) : mixed Gets/sets the number of occurences.
where ( $requirements = [] ) : self Set arguments requirement indexed by method name.
with ( ) : self Sets arguments requirement.

Protected Methods

Method Description
_check ( mixed $reference ) Check the actual value can receive messages.
_reference ( mixed $reference ) Return the actual reference which must be used.
_watch ( $message ) Watch a message.

Method Details

__construct() public method

Constructor
public __construct ( string | object $actual, string $expected )
$actual string | object A fully-namespaced class name or an object instance.
$expected string The expected method method name to be called.

__get() public method

Magic getter, if called with 'ordered' will set ordered to true.
public __get ( $name )

_buildDescription() public method

Build the description of the runned ::match() call.
public _buildDescription ( mixed $startIndex )
$startIndex mixed The startIndex in calls log.

_check() protected method

Check the actual value can receive messages.
protected _check ( mixed $reference )
$reference mixed An instance or a fully-namespaced class name.

_reference() protected method

Return the actual reference which must be used.
protected _reference ( mixed $reference )
$reference mixed An instance or a fully-namespaced class name.

_watch() protected method

Watch a message.
protected _watch ( $message )

backtrace() public method

Gets the backtrace reference.
public backtrace ( ) : object
return object

description() public method

Returns the description report.
public description ( )

match() public static method

Checks that $actual receive the $expected message.
public static match ( mixed $actual, mixed $expected = null ) : boolean
$actual mixed The actual value.
$expected mixed The expected message.
return boolean

once() public method

Sets the number of occurences.
public once ( ) : self
return self

resolve() public method

Resolves the matching.
public resolve ( ) : boolean
return boolean Returns `true` if successfully resolved, `false` otherwise.

times() public method

Gets/sets the number of occurences.
public times ( integer $times = null ) : mixed
$times integer The number of occurences to set or none to get it.
return mixed The number of occurences on get or `self` otherwise.

where() public method

Set arguments requirement indexed by method name.
public where ( $requirements = [] ) : self
return self

with() public method

Sets arguments requirement.
public with ( ) : self
return self

Property Details

$_backtrace protected_oe property

The expectation backtrace reference.
protected array $_backtrace
return array

$_description protected_oe property

The description report.
protected array $_description
return array

$_expected protected_oe property

The expected method method name to be called.
protected array $_expected
return array

$_messages protected_oe property

The messages instance.
protected object $_messages
return object

$_ordered protected_oe property

If true, will take the calling order into account.
protected bool $_ordered
return boolean

$_report protected_oe property

The report.
protected array $_report
return array

$_times protected_oe property

Number of occurences to match.
protected int $_times
return integer