PHP Class pho\Runner\Runner

Datei anzeigen Open project: danielstjules/pho Class Usage Examples

Public Properties

Property Type Description
$console

Protected Properties

Property Type Description
$instance

Public Methods

Method Description
after ( Closure $closure ) Constructs a new Hook, defining a closure to be ran after the parent suite's closure.
afterEach ( Closure $closure ) Constructs a new Hook, defining a closure to be ran prior to each of the parent suite's nested suites and specs.
before ( Closure $closure ) Constructs a new Hook, defining a closure to be ran prior to the parent suite's closure.
beforeEach ( Closure $closure ) Constructs a new Hook, defining a closure to be ran prior to each of the parent suite's nested suites and specs.
describe ( string $title, Closure $closure ) Constructs a test Suite, assigning it the given title and anonymous function. If it's a child of another suite, a reference to the parent suite is stored. This is done by tracking the current and previously defined suites.
getInstance ( ) : Runner Returns the singleton instance.
it ( string $title, Closure $closure = null ) Constructs a new Spec, adding it to the list of specs in the current suite.
run ( ) Starts the test runner by first invoking the associated reporter's beforeRun() method, then iterating over all defined suites and running their specs, and calling the reporter's afterRun() when complete.
watch ( ) Monitors the the current working directory for modifications, and reruns the specs in another process on change.
xdescribe ( string $title, Closure $closure ) Constructs a test Suite, assigning it the given title and anonymous function. If it's a child of another suite, a reference to the parent suite is stored. This is done by tracking the current and previously defined suites.
xit ( string $title, Closure $closure = null ) Constructs a new Spec, adding it to the list of specs in the current suite and mark it as pending.

Private Methods

Method Description
runAfterEachHooks ( pho\Suite\Suite $suite ) Runs the afterEach hooks of the given suite and its parent suites recursively. They are ran in the order in the opposite order, from inner suites to outer suites.
runBeforeEachHooks ( pho\Suite\Suite $suite ) Runs the beforeEach hooks of the given suite and its parent suites recursively. They are ran in the order in which they were defined, from outer suite to inner suites.
runRunnable ( $runnable ) A short helper method that calls an object's run() method only if it's an instance of Runnable.
runSpecs ( pho\Suite\Suite $suite ) Runs the specs associated with the provided test suite. It iterates over and runs each spec, calling the reporter's beforeSpec and afterSpec methods, as well as the suite's beforeEach and aferEach hooks. If the filter option is used, only specs containing a pattern are ran. And if the stop flag is used, it quits when an exception or error is thrown.
runSuite ( pho\Suite\Suite $suite ) Runs a particular suite by running the associated hooks and reporter, methods, iterating over its child suites and recursively calling itself, followed by running its specs.

Method Details

after() public method

Constructs a new Hook, defining a closure to be ran after the parent suite's closure.
public after ( Closure $closure )
$closure Closure The closure to be ran after the suite

afterEach() public method

Constructs a new Hook, defining a closure to be ran prior to each of the parent suite's nested suites and specs.
public afterEach ( Closure $closure )
$closure Closure The closure to be ran after each spec

before() public method

Constructs a new Hook, defining a closure to be ran prior to the parent suite's closure.
public before ( Closure $closure )
$closure Closure The closure to be ran before the suite

beforeEach() public method

Constructs a new Hook, defining a closure to be ran prior to each of the parent suite's nested suites and specs.
public beforeEach ( Closure $closure )
$closure Closure The closure to be ran before each spec

describe() public method

Constructs a test Suite, assigning it the given title and anonymous function. If it's a child of another suite, a reference to the parent suite is stored. This is done by tracking the current and previously defined suites.
public describe ( string $title, Closure $closure )
$title string A title to be associated with the suite
$closure Closure The closure to invoke when the suite is ran

getInstance() public static method

Returns the singleton instance.
public static getInstance ( ) : Runner
return Runner The singleton instance

it() public method

Constructs a new Spec, adding it to the list of specs in the current suite.
public it ( string $title, Closure $closure = null )
$title string A title to be associated with the spec
$closure Closure The closure to invoke when the spec is ran

run() public method

Starts the test runner by first invoking the associated reporter's beforeRun() method, then iterating over all defined suites and running their specs, and calling the reporter's afterRun() when complete.
public run ( )

watch() public method

Monitors the the current working directory for modifications, and reruns the specs in another process on change.
public watch ( )

xdescribe() public method

After all, mark the Suit as pending.
public xdescribe ( string $title, Closure $closure )
$title string A title to be associated with the suite
$closure Closure The closure to invoke when the suite is ran

xit() public method

Constructs a new Spec, adding it to the list of specs in the current suite and mark it as pending.
public xit ( string $title, Closure $closure = null )
$title string A title to be associated with the spec
$closure Closure The closure to invoke when the spec is ran

Property Details

$console public_oe static_oe property

public static $console

$instance protected_oe static_oe property

protected static $instance