PHP Класс kahlan\Scope

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

Открытые свойства

Свойство Тип Описание
$blacklist array List of reserved keywords which can't be used as scope variable.

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

Свойство Тип Описание
$_backtrace object The scope backtrace.
$_backtraceFocus string A regexp pattern used to removes useless traces to focus on the one related to a spec file.
$_closure Closur\Closure The spec closure.
$_data array The scope's data.
$_failures integer Count the number of failure or exception.
$_given array The lazy loaded scope's data.
$_instances Scope[] Instances stack.
$_locked Boolean lock which avoid process() to be called in tests
$_log object The report log of executed spec.
$_message string The spec message.
$_parent Scope The parent instance.
$_passed boolean Stores the success value.
$_reporters object The reporters container.
$_root object The root instance.
$_runned boolean Indicates whether the scope has been runned or not.
$_summary object The execution summary instance.
$_timeout integer The timeout value.
$_type object The scope type.

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

Метод Описание
__call ( string $name, array $args ) : mixed Allow closures assigned to the scope property to be inkovable.
__construct ( array $config = [] ) The Constructor.
__get ( string $key ) : mixed Getter.
__set ( string $key, mixed $value ) : mixed Setter.
backtrace ( ) : array Gets the backtrace array.
backtraceFocus ( string $pattern = null ) : string Gets/sets the regexp pattern used to removes useless traces to focus on the one related to a spec file.
current ( ) : Scope Get the active scope instance.
excluded ( ) : boolean Check for excluded mode.
focused ( ) : boolean Check for focused mode.
given ( string $name, Closur\Closure $closure ) : object Sets a lazy loaded data.
log ( $type = null, $data = [] ) Dispatches a report up to the root scope.
message ( ) : array Gets the spec's message.
messages ( ) : array Gets all messages upon the root.
parent ( ) : Scope Gets the parent instance.
report ( string $type, mixed $data, $byPassFocuses = false ) Send some data to reporters.
reporters ( ) : object Gets the reporters container.
skipIf ( boolean $condition ) Skips specs(s) if the condition is true.
summary ( ) : array Gets specs excecution results.
timeout ( $timeout = null ) : integer Gets/sets the timeout.
type ( $type = null ) : mixed Set/get the scope type.

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

Метод Описание
_bind ( Closur\Closure $closure, string $name ) : Closur\Closure Binds the closure to the current context.
_emitFocus ( ) Applies focus up to the root.
_exception ( Exception $exception, boolean $inEachHook = false ) Manages catched exception.
_parents ( boolean $current = false ) : array. Gets all parent instances.
_skipChildren ( object $exception, boolean $emit = false ) Skips children specs(s).

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

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

Allow closures assigned to the scope property to be inkovable.
public __call ( string $name, array $args ) : mixed
$name string Name of the method being called.
$args array Enumerated array containing the passed arguments.
Результат mixed

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

The Constructor.
public __construct ( array $config = [] )
$config array The Suite config array. Options are: -`'type'` _string_ : supported type are `'normal'` & `'focus'`. -`'message'` _string_ : the description message. -`'parent'` _object_ : the parent scope. -`'root'` _object_ : the root scope. -`'log'` _object_ : the log instance. -`'timeout'` _integer_: the timeout.

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

Getter.
public __get ( string $key ) : mixed
$key string The name of the variable.
Результат mixed The value of the variable.

__set() публичный Метод

Setter.
public __set ( string $key, mixed $value ) : mixed
$key string The name of the variable.
$value mixed The value of the variable.
Результат mixed The value of the variable.

_bind() защищенный Метод

Binds the closure to the current context.
protected _bind ( Closur\Closure $closure, string $name ) : Closur\Closure
$closure Closur\Closure The variable to check
$name string Name of the parent type (TODO: to use somewhere).
Результат Closur\Closure

_emitFocus() защищенный Метод

Applies focus up to the root.
protected _emitFocus ( )

_exception() защищенный Метод

Manages catched exception.
protected _exception ( Exception $exception, boolean $inEachHook = false )
$exception Exception The catched exception.
$inEachHook boolean Indicates if the exception occurs in a beforeEach/afterEach hook.

_parents() защищенный Метод

Gets all parent instances.
protected _parents ( boolean $current = false ) : array.
$current boolean If `true` include `$this` to the list.
Результат array.

_skipChildren() защищенный Метод

Skips children specs(s).
protected _skipChildren ( object $exception, boolean $emit = false )
$exception object The exception at the origin of the skip.
$emit boolean Indicated if report events should be generated.

backtrace() публичный Метод

Gets the backtrace array.
public backtrace ( ) : array
Результат array

backtraceFocus() публичный Метод

Gets/sets the regexp pattern used to removes useless traces to focus on the one related to a spec file.
public backtraceFocus ( string $pattern = null ) : string
$pattern string A wildcard pattern (i.e. `fnmatch()` style).
Результат string The focus regexp.

current() публичный статический Метод

Get the active scope instance.
public static current ( ) : Scope
Результат Scope The object instance or `null` if there's no active instance.

excluded() публичный Метод

Check for excluded mode.
public excluded ( ) : boolean
Результат boolean

focused() публичный Метод

Check for focused mode.
public focused ( ) : boolean
Результат boolean

given() публичный Метод

Sets a lazy loaded data.
public given ( string $name, Closur\Closure $closure ) : object
$name string The lazy loaded variable name.
$closure Closur\Closure The lazily executed closure.
Результат object

log() публичный Метод

It only logs expectations report.
public log ( $type = null, $data = [] )

message() публичный Метод

Gets the spec's message.
public message ( ) : array
Результат array

messages() публичный Метод

Gets all messages upon the root.
public messages ( ) : array
Результат array

parent() публичный Метод

Gets the parent instance.
public parent ( ) : Scope
Результат Scope

report() публичный Метод

Send some data to reporters.
public report ( string $type, mixed $data, $byPassFocuses = false )
$type string The message type.
$data mixed The message data.

reporters() публичный Метод

Gets the reporters container.
public reporters ( ) : object
Результат object

skipIf() публичный Метод

Skips specs(s) if the condition is true.
public skipIf ( boolean $condition )
$condition boolean

summary() публичный Метод

Gets specs excecution results.
public summary ( ) : array
Результат array

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

Gets/sets the timeout.
public timeout ( $timeout = null ) : integer
Результат integer

type() публичный Метод

Set/get the scope type.
public type ( $type = null ) : mixed
Результат mixed

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

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

The scope backtrace.
protected object $_backtrace
Результат object

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

A regexp pattern used to removes useless traces to focus on the one related to a spec file.
protected string $_backtraceFocus
Результат string

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

The spec closure.
protected Closure,Closur $_closure
Результат Closur\Closure

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

The scope's data.
protected array $_data
Результат array

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

Count the number of failure or exception.
См. также: ::failfast()
protected int $_failures
Результат integer

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

The lazy loaded scope's data.
protected array $_given
Результат array

$_instances защищенное статическое свойство

Instances stack.
protected static Scope[],kahlan $_instances
Результат Scope[]

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

Boolean lock which avoid process() to be called in tests
protected $_locked

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

The report log of executed spec.
protected object $_log
Результат object

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

The spec message.
protected string $_message
Результат string

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

The parent instance.
protected Scope,kahlan $_parent
Результат Scope

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

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

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

The reporters container.
protected object $_reporters
Результат object

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

The root instance.
protected object $_root
Результат object

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

Indicates whether the scope has been runned or not.
protected bool $_runned
Результат boolean

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

The execution summary instance.
protected object $_summary
Результат object

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

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

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

The scope type.
protected object $_type
Результат object

$blacklist публичное статическое свойство

List of reserved keywords which can't be used as scope variable.
public static array $blacklist
Результат array