PHP Класс kahlan\Suite

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

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

Свойство Тип Описание
$PHP

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

Свойство Тип Описание
$_autoclear array Array of fully-namespaced class name to clear on each it().
$_callbacks array The each callbacks.
$_children Suite[] | Specification[] The children array.
$_ff integer Set the number of fails allowed before aborting. 0 mean no fast fail.
$_registered array Store all hashed references.
$_stats array Suite statistics.
$_status integer The return status value (0 for success).

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

Метод Описание
__construct ( array $config = [] ) The Constructor.
afterAll ( Closure $closure ) : self Executed after tests.
afterEach ( Closure $closure ) : self Executed after each tests.
autoclear ( ) Autoclears plugins.
beforeAll ( Closure $closure ) : self Executed before tests.
beforeEach ( Closure $closure ) : self Executed before each tests.
callbacks ( string $type ) : array Gets callbacks.
children ( ) : array Gets children.
context ( string $message, Closure $closure, null $timeout = null, string $type = 'normal' ) : Suite Adds a context related spec.
describe ( string $message, Closure $closure, $timeout = null, $type = 'normal' ) : Suite Adds a group/class related spec.
enabled ( ) : integer Gets number of enabled specs.
failfast ( ) : boolean; Returns true if the suite reach the number of allowed failure by the fail-fast parameter.
fcontext ( string $message, Closure $closure, $timeout = null ) : Suite Adds an focused context related spec.
fdescribe ( string $message, Closure $closure, $timeout = null ) : Suite Adds an focused group/class related spec.
fit ( string | Closur\Closure $message, Closur\Closure | null $closure = null, $timeout = null ) : Specification Adds an focused spec.
hash ( mixed $reference ) : string Generates a hash from an instance or a string.
it ( string | Closur\Closure $message, Closure $closure = null, $timeout = null, string $type = 'normal' ) : Specification Adds a spec.
passed ( ) : boolean Checks if all test passed.
register ( mixed $hash ) Registers a hash. [Mainly used for optimization]
registered ( string $hash = null ) : array | boolean Gets registered hashes. [Mainly used for optimizations]
reset ( ) Clears the registered hash.
run ( array $options = [] ) : boolean Runs all specs.
runCallbacks ( string $name, $recursive = true ) Runs a callback.
status ( integer $status = null ) : boolean Gets exit status code according passed results.
stop ( ) Triggers the stop event.
total ( ) : integer Gets number of total specs.
xcontext ( string $message, Closure $closure, $timeout = null ) Comments out a context related spec.
xdescribe ( string $message, Closure $closure, $timeout = null ) Comments out a group/class related spec.
xit ( string | Closur\Closure $message, Closur\Closure | null $closure = null, $timeout = null ) Comments out a spec.

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

Метод Описание
_broadcastFocus ( ) Applies focus downward to the leaf.
_errorHandler ( boolean $enable, array $options = [] ) Overrides the default error handler
_process ( array $options = [] ) Suite processing.
_stats ( ) : array Builds the suite.
_suiteEnd ( ) Suite end helper.
_suiteStart ( ) Suite start helper.
stats ( ) : array Builds the suite.

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

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

The Constructor.
public __construct ( array $config = [] )
$config array The Suite config array. Options are: -`'closure'` _Closure_: the closure of the test. -`'name'` _string_ : the type of the suite.

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

Applies focus downward to the leaf.
protected _broadcastFocus ( )

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

Overrides the default error handler
protected _errorHandler ( boolean $enable, array $options = [] )
$enable boolean If `true` override the default error handler, if `false` restore the default handler.
$options array An options array. Available options are: - 'handler': An error handler closure.

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

Suite processing.
protected _process ( array $options = [] )
$options array Process options.

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

Builds the suite.
protected _stats ( ) : array
Результат array The suite stats.

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

Suite end helper.
protected _suiteEnd ( )

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

Suite start helper.
protected _suiteStart ( )

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

Executed after tests.
public afterAll ( Closure $closure ) : self
$closure Closure A closure
Результат self

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

Executed after each tests.
public afterEach ( Closure $closure ) : self
$closure Closure A closure
Результат self

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

Autoclears plugins.
public autoclear ( )

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

Executed before tests.
public beforeAll ( Closure $closure ) : self
$closure Closure A closure
Результат self

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

Executed before each tests.
public beforeEach ( Closure $closure ) : self
$closure Closure A closure
Результат self

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

Gets callbacks.
public callbacks ( string $type ) : array
$type string The type of callbacks to get.
Результат array The array callbacks instances.

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

Gets children.
public children ( ) : array
Результат array The array of children instances.

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

Adds a context related spec.
public context ( string $message, Closure $closure, null $timeout = null, string $type = 'normal' ) : Suite
$message string Description message.
$closure Closure A test case closure.
$timeout null
$type string
Результат Suite

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

Adds a group/class related spec.
public describe ( string $message, Closure $closure, $timeout = null, $type = 'normal' ) : Suite
$message string Description message.
$closure Closure A test case closure.
Результат Suite

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

Gets number of enabled specs.
public enabled ( ) : integer
Результат integer

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

Returns true if the suite reach the number of allowed failure by the fail-fast parameter.
public failfast ( ) : boolean;
Результат boolean;

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

Adds an focused context related spec.
public fcontext ( string $message, Closure $closure, $timeout = null ) : Suite
$message string Description message.
$closure Closure A test case closure.
Результат Suite

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

Adds an focused group/class related spec.
public fdescribe ( string $message, Closure $closure, $timeout = null ) : Suite
$message string Description message.
$closure Closure A test case closure.
Результат Suite

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

Adds an focused spec.
public fit ( string | Closur\Closure $message, Closur\Closure | null $closure = null, $timeout = null ) : Specification
$message string | Closur\Closure Description message or a test closure.
$closure Closur\Closure | null A test case closure or `null`.
Результат Specification

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

Generates a hash from an instance or a string.
public static hash ( mixed $reference ) : string
$reference mixed An instance or a fully namespaced class name.
Результат string A string hash.

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

Adds a spec.
public it ( string | Closur\Closure $message, Closure $closure = null, $timeout = null, string $type = 'normal' ) : Specification
$message string | Closur\Closure Description message or a test closure.
$closure Closure A test case closure.
$type string The type.
Результат Specification

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

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

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

Registers a hash. [Mainly used for optimization]
public static register ( mixed $hash )
$hash mixed A hash to register.

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

Gets registered hashes. [Mainly used for optimizations]
public static registered ( string $hash = null ) : array | boolean
$hash string The hash to look up. If none return all registered hashes.
Результат array | boolean

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

Clears the registered hash.
public static reset ( )

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

Runs all specs.
public run ( array $options = [] ) : boolean
$options array Run options.
Результат boolean The result array.

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

Runs a callback.
public runCallbacks ( string $name, $recursive = true )
$name string The name of the callback (i.e `'beforeEach'` or `'afterEach'`).

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

Builds the suite.
protected stats ( ) : array
Результат array The suite stats.

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

Gets exit status code according passed results.
public status ( integer $status = null ) : boolean
$status integer If set force a specific status to be retruned.
Результат boolean Returns `0` if no error occurred, `-1` otherwise.

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

Triggers the stop event.
public stop ( )

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

Gets number of total specs.
public total ( ) : integer
Результат integer

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

Comments out a context related spec.
public xcontext ( string $message, Closure $closure, $timeout = null )
$message string Description message.
$closure Closure A test case closure.

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

Comments out a group/class related spec.
public xdescribe ( string $message, Closure $closure, $timeout = null )
$message string Description message.
$closure Closure A test case closure.

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

Comments out a spec.
public xit ( string | Closur\Closure $message, Closur\Closure | null $closure = null, $timeout = null )
$message string | Closur\Closure Description message or a test closure.
$closure Closur\Closure | null A test case closure or `null`.

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

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

public static $PHP

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

Array of fully-namespaced class name to clear on each it().
protected array $_autoclear
Результат array

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

The each callbacks.
protected array $_callbacks
Результат array

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

The children array.
protected Suite[],kahlan|Specification[],kahlan $_children
Результат Suite[] | Specification[]

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

Set the number of fails allowed before aborting. 0 mean no fast fail.
См. также: ::failfast()
protected int $_ff
Результат integer

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

Store all hashed references.
protected static array $_registered
Результат array

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

Suite statistics.
protected array $_stats
Результат array

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

The return status value (0 for success).
protected int $_status
Результат integer