PHP Class kahlan\Suite

Inheritance: extends Scope
Afficher le fichier Open project: crysalead/kahlan Class Usage Examples

Méthodes publiques

Свойство Type Description
$PHP

Protected Properties

Свойство Type Description
$_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).

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
_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.

Method Details

__construct() public méthode

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() protected méthode

Applies focus downward to the leaf.
protected _broadcastFocus ( )

_errorHandler() protected méthode

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() protected méthode

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

_stats() protected méthode

Builds the suite.
protected _stats ( ) : array
Résultat array The suite stats.

_suiteEnd() protected méthode

Suite end helper.
protected _suiteEnd ( )

_suiteStart() protected méthode

Suite start helper.
protected _suiteStart ( )

afterAll() public méthode

Executed after tests.
public afterAll ( Closure $closure ) : self
$closure Closure A closure
Résultat self

afterEach() public méthode

Executed after each tests.
public afterEach ( Closure $closure ) : self
$closure Closure A closure
Résultat self

autoclear() public méthode

Autoclears plugins.
public autoclear ( )

beforeAll() public méthode

Executed before tests.
public beforeAll ( Closure $closure ) : self
$closure Closure A closure
Résultat self

beforeEach() public méthode

Executed before each tests.
public beforeEach ( Closure $closure ) : self
$closure Closure A closure
Résultat self

callbacks() public méthode

Gets callbacks.
public callbacks ( string $type ) : array
$type string The type of callbacks to get.
Résultat array The array callbacks instances.

children() public méthode

Gets children.
public children ( ) : array
Résultat array The array of children instances.

context() public méthode

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
Résultat Suite

describe() public méthode

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.
Résultat Suite

enabled() public méthode

Gets number of enabled specs.
public enabled ( ) : integer
Résultat integer

failfast() public méthode

Returns true if the suite reach the number of allowed failure by the fail-fast parameter.
public failfast ( ) : boolean;
Résultat boolean;

fcontext() public méthode

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.
Résultat Suite

fdescribe() public méthode

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.
Résultat Suite

fit() public méthode

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`.
Résultat Specification

hash() public static méthode

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.
Résultat string A string hash.

it() public méthode

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.
Résultat Specification

passed() public méthode

Checks if all test passed.
public passed ( ) : boolean
Résultat boolean Returns `true` if no error occurred, `false` otherwise.

register() public static méthode

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

registered() public static méthode

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.
Résultat array | boolean

reset() public static méthode

Clears the registered hash.
public static reset ( )

run() public méthode

Runs all specs.
public run ( array $options = [] ) : boolean
$options array Run options.
Résultat boolean The result array.

runCallbacks() public méthode

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

stats() protected méthode

Builds the suite.
protected stats ( ) : array
Résultat array The suite stats.

status() public méthode

Gets exit status code according passed results.
public status ( integer $status = null ) : boolean
$status integer If set force a specific status to be retruned.
Résultat boolean Returns `0` if no error occurred, `-1` otherwise.

stop() public méthode

Triggers the stop event.
public stop ( )

total() public méthode

Gets number of total specs.
public total ( ) : integer
Résultat integer

xcontext() public méthode

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() public méthode

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() public méthode

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`.

Property Details

$PHP public_oe static_oe property

public static $PHP

$_autoclear protected_oe property

Array of fully-namespaced class name to clear on each it().
protected array $_autoclear
Résultat array

$_callbacks protected_oe property

The each callbacks.
protected array $_callbacks
Résultat array

$_children protected_oe property

The children array.
protected Suite[],kahlan|Specification[],kahlan $_children
Résultat Suite[] | Specification[]

$_ff protected_oe property

Set the number of fails allowed before aborting. 0 mean no fast fail.
See also: ::failfast()
protected int $_ff
Résultat integer

$_registered protected_oe static_oe property

Store all hashed references.
protected static array $_registered
Résultat array

$_stats protected_oe property

Suite statistics.
protected array $_stats
Résultat array

$_status protected_oe property

The return status value (0 for success).
protected int $_status
Résultat integer