TestSuite

A named suite of test cases that are executed altogether. The suite suite is created with the @see \io\vertx\jphp\ext\unit\TestSuite::create and the returned suite contains initially no tests.<p/>

The suite can declare a callback before the suite with @see \io\vertx\jphp\ext\unit\TestSuite::before or after the suite with @see \io\vertx\jphp\ext\unit\TestSuite::after.

The suite can declare a callback before each test with @see \io\vertx\jphp\ext\unit\TestSuite::beforeEach or after each test with @see \io\vertx\jphp\ext\unit\TestSuite::afterEach.

Each test case of the suite is declared by calling the @see \io\vertx\jphp\ext\unit\TestSuite::test method.

package

Default

Methods

__construct

__construct() 

Set a callback executed after the tests.

after( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Set a callback executed after each test and before the suite <code>after</code> callback.

afterEach( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Set a callback executed before the tests.

before( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Set a callback executed before each test and after the suite <code>before</code> callback.

beforeEach( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Create and return a new test suite.

create( $arg0) : \io\vertx\jphp\ext\unit\TestSuite
static

Arguments

$arg0

string

Response

\io\vertx\jphp\ext\unit\TestSuite

the created test suite

Run the testsuite with the default options.<p/>

run( $arg0 = null,  $arg1 = null) : \io\vertx\jphp\ext\unit\TestCompletion

When the test suite is executed in a Vertx context (i.e Vertx.currentContext() returns a context) this context's event loop is used for running the test suite. Otherwise it is executed in the current thread.

The returned @see \io\vertx\jphp\ext\unit\Completion object can be used to get a completion callback.

run()

Run the testsuite with the specified options.

When the test suite is executed in a Vertx context (i.e Vertx.currentContext() returns a context) this context's event loop is used for running the test suite unless the @see \io\vertx\jphp\ext\unit\TestOptions is set to false. In this case it is executed by the current thread.

Otherwise, the test suite will be executed in the current thread when @see \io\vertx\jphp\ext\unit\TestOptions is set to false or null. If the value is true, this methods throws an IllegalStateException.

The returned @see \io\vertx\jphp\ext\unit\Completion object can be used to get a completion callback.

param $options [TestOptions | array] the test options run($options)

Run the testsuite with the default options and the specified vertx instance.

The test suite will be executed on the event loop provided by the vertx argument. The returned

see \io\vertx\jphp\ext\unit\Completion

object can be used to get a completion callback.

param $vertx [Vertx] the vertx instance run($vertx)

Run the testsuite with the specified options and the specified vertx instance.

The test suite will be executed on the event loop provided by the vertx argument when

\io\vertx\jphp\ext\unit\TestOptions

is not set to false. The returned

\io\vertx\jphp\ext\unit\Completion

object can be used to get a completion callback.

param $vertx [Vertx] the vertx instance param $options [TestOptions | array] the test options run($vertx, $options)

Arguments

$arg0

TestOptions | array | Vertx

$arg1

TestOptions | array

Response

\io\vertx\jphp\ext\unit\TestCompletion

the related test completion

Add a new test case to the suite.

test( $arg0,  $arg1,  $arg2 = null) : $this

param $name [string] the test case name param $testCase [callable] the test case test($name, $testCase)

Add a new test case to the suite.

param $name [string] the test case name param $repeat [integer] the number of times the test should be repeated param $testCase [callable] the test case test($name, $repeat, $testCase)

Arguments

$arg0

string

$arg1

callable | integer

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently