PHP Класс kahlan\Expectation

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_actual mixed The current value to test.
$_deferred array Deferred expectation.
$_logs array The result logs.
$_not boolean If true, the result of the test will be inverted.
$_passed boolean Stores the success value.
$_timeout integer The timeout value.

Открытые методы

Метод Описание
__call ( string $matcherName, array $args ) : boolean Calls a registered matcher.
__construct ( array $config = [] ) Constructor.
__get ( $name ) Magic getter, if called with 'not' invert the _not attribute.
_matcher ( string $matcherName, mixed $actual ) : string Returns a compatible matcher class name according to a passed actual value.
actual ( ) : boolean Returns the actual value.
clear ( ) Clears the instance.
deferred ( ) : array Returns the deferred expectations.
logs ( ) Returns the logs.
not ( ) : boolean Returns the not value.
passed ( ) : boolean Checks if all test passed.
timeout ( ) Returns the timeout value.

Защищенные методы

Метод Описание
_log ( boolean $boolean, array $data = [] ) : boolean Logs a result.
_resolve ( ) Resolves deferred matchers.
_run ( ) : mixed Processes the expectation.
_spin ( Closure $closure ) Runs the expectation.

Описание методов

__call() публичный метод

Calls a registered matcher.
public __call ( string $matcherName, array $args ) : boolean
$matcherName string The name of the matcher.
$args array The arguments to pass to the matcher.
Результат boolean

__construct() публичный метод

Constructor.
public __construct ( array $config = [] )
$config array The config array. Options are: -`'actual'` _mixed_ : the actual value. -`'timeout'` _integer_ : the timeout value.

__get() публичный метод

Magic getter, if called with 'not' invert the _not attribute.
public __get ( $name )

_log() защищенный метод

Logs a result.
protected _log ( boolean $boolean, array $data = [] ) : boolean
$boolean boolean Set `true` for success and `false` for failure.
$data array Test details array.
Результат boolean

_matcher() публичный метод

Returns a compatible matcher class name according to a passed actual value.
public _matcher ( string $matcherName, mixed $actual ) : string
$matcherName string The name of the matcher.
$actual mixed The actual value.
Результат string A matcher class name.

_resolve() защищенный метод

Resolves deferred matchers.
protected _resolve ( )

_run() защищенный метод

Processes the expectation.
protected _run ( ) : mixed
Результат mixed

_spin() защищенный метод

Runs the expectation.
protected _spin ( Closure $closure )
$closure Closure The closure to run/spin.

actual() публичный метод

Returns the actual value.
public actual ( ) : boolean
Результат boolean

clear() публичный метод

Clears the instance.
public clear ( )

deferred() публичный метод

Returns the deferred expectations.
public deferred ( ) : array
Результат array

logs() публичный метод

Returns the logs.
public logs ( )

not() публичный метод

Returns the not value.
public not ( ) : boolean
Результат boolean

passed() публичный метод

Checks if all test passed.
public passed ( ) : boolean
Результат boolean Returns `true` if no error occurred, `false` otherwise.

timeout() публичный метод

Returns the timeout value.
public timeout ( )

Описание свойств

$_actual защищенное свойство

The current value to test.
protected mixed $_actual
Результат mixed

$_deferred защищенное свойство

Deferred expectation.
protected array $_deferred
Результат array

$_logs защищенное свойство

The result logs.
protected array $_logs
Результат array

$_not защищенное свойство

If true, the result of the test will be inverted.
protected bool $_not
Результат boolean

$_passed защищенное свойство

Stores the success value.
protected bool $_passed
Результат boolean

$_timeout защищенное свойство

The timeout value.
protected int $_timeout
Результат integer