The test context is used for performing test assertions and manage the completion of the test. This context is provided by <i>vertx-unit</i> as argument of the test case.
package |
Default |
---|
__construct()
assertEquals( $arg0, $arg1, $arg2 = null) : $this
param $expected [mixed] the object the actual object is supposedly equals to param $actual [mixed] the actual object to test assertEquals($expected, $actual)
Assert the expected
argument is equals to the actual
argument. If the arguments are not equals
an assertion error is thrown otherwise the execution continue.
param $expected [mixed] the object the actual object is supposedly equals to param $actual [mixed] the actual object to test param $message [string] the failure message assertEquals($expected, $actual, $message)
mixed
mixed
string
$this
a reference to this, so the API can be used fluently
assertFalse( $arg0, $arg1 = null) : $this
param $condition [boolean] the condition to assert assertFalse($condition)
Assert the specified condition
is false
. If the condition is true
, an assertion error is thrown
otherwise the execution continue.
param $condition [boolean] the condition to assert param $message [string] the failure message assertFalse($condition, $message)
boolean
string
$this
a reference to this, so the API can be used fluently
assertInRange( $arg0, $arg1, $arg2, $arg3 = null) : $this
param $expected [float] the object the actual object is supposedly equals to param $actual [float] the actual object to test param $delta [float] the maximum delta assertInRange($expected, $actual, $delta)
Asserts that the expected
double argument is equals to the actual
double argument
within a positive delta. If the arguments do not satisfy this, an assertion error is thrown otherwise
the execution continue.
param $expected [float] the object the actual object is supposedly equals to param $actual [float] the actual object to test param $delta [float] the maximum delta param $message [string] the failure message assertInRange($expected, $actual, $delta, $message)
float
float
float
string
$this
a reference to this, so the API can be used fluently
assertNotEquals( $arg0, $arg1, $arg2 = null) : $this
param $first [mixed] the first object to test param $second [mixed] the second object to test assertNotEquals($first, $second)
Assert the first
argument is not equals to the second
argument. If the arguments are equals
an assertion error is thrown otherwise the execution continue.
param $first [mixed] the first object to test param $second [mixed] the second object to test param $message [string] the failure message assertNotEquals($first, $second, $message)
mixed
mixed
string
$this
a reference to this, so the API can be used fluently
assertNotNull( $arg0, $arg1 = null) : $this
param $expected [mixed] the argument being asserted to be not null assertNotNull($expected)
Assert the expected
argument is not null
. If the argument is null
, an assertion error is thrown
otherwise the execution continue.
param $expected [mixed] the argument being asserted to be not null param $message [string] the failure message assertNotNull($expected, $message)
mixed
string
$this
a reference to this, so the API can be used fluently
assertNull( $arg0, $arg1 = null) : $this
param $expected [mixed] the argument being asserted to be null assertNull($expected)
Assert the expected
argument is null
. If the argument is not, an assertion error is thrown
otherwise the execution continue.
param $expected [mixed] the argument being asserted to be null param $message [string] the failure message assertNull($expected, $message)
mixed
string
$this
a reference to this, so the API can be used fluently
assertTrue( $arg0, $arg1 = null) : $this
param $condition [boolean] the condition to assert assertTrue($condition)
Assert the specified condition
is true
. If the condition is false
, an assertion error is thrown
otherwise the execution continue.
param $condition [boolean] the condition to assert param $message [string] the failure message assertTrue($condition, $message)
boolean
string
$this
a reference to this, so the API can be used fluently
async( $arg0 = null) : \io\vertx\jphp\ext\unit\Async
see |
\io\vertx\jphp\ext\unit\Async::complete
completes the async operation. The test case will complete when all the async objects have their @see \io\vertx\jphp\ext\unit\Async::complete method called at least once. This method shall be used for creating asynchronous exit points for the executed test. async() Create and returns a new async object, the returned async controls the completion of the test. This async operation
completes when the @see \io\vertx\jphp\ext\unit\Async::countDown is called The test case will complete when all the async objects have their @see \io\vertx\jphp\ext\unit\Async::complete method called at least once. This method shall be used for creating asynchronous exit points for the executed test. param $count [integer] async($count) |
---|
integer
\io\vertx\jphp\ext\unit\Async
the async instance
asyncAssertFailure( $arg0 = null) : callable
When the returned handler is called back with a failed result it completes the async operation.
When the returned handler is called back with a succeeded result it fails the test.
asyncAssertFailure()
Creates and returns a new async handler, the returned handler controls the completion of the test.
When the returned handler is called back with a failed result it completes the async operation.
When the returned handler is called back with a succeeded result it fails the test.
param $causeHandler [callable] the cause handler asyncAssertFailure($causeHandler)
callable
callable
the async result handler
asyncAssertSuccess( $arg0 = null) : callable
When the returned handler is called back with a succeeded result it completes the async operation.
When the returned handler is called back with a failed result it fails the test with the cause of the failure.
asyncAssertSuccess()
Creates and returns a new async handler, the returned handler controls the completion of the test.
When the returned handler is called back with a succeeded result it invokes the resultHandler
argument
with the async result. The test completes after the result handler is invoked and does not fails.
When the returned handler is called back with a failed result it fails the test with the cause of the failure.
Note that the result handler can create other async objects during its invocation that would postpone the completion of the test case until those objects are resolved.
param $resultHandler [callable] the result handler asyncAssertSuccess($resultHandler)
callable
callable
the async result handler
exceptionHandler() : callable
callable
an exception handler that will fail this context
fail( $arg0 = null) : void
fail()
Throw a failure with the specified failure message
.
param $message [string] the failure message fail($message)
Throw a failure with the specified failure cause
.
param $cause [\Exception] the failure cause fail($cause)
string | \Exception
get( $arg0) : mixed
string
mixed
the data
put( $arg0, $arg1) : mixed
This can be used to share data between different tests and before/after phases.
string
mixed
mixed
the previous object when it exists
remove( $arg0) : mixed
string
mixed
the removed object when it exists
strictAsync( $arg0) : \io\vertx\jphp\ext\unit\Async
This async operation completes when the @see \io\vertx\jphp\ext\unit\Async::countDown is called count
times.
count
times, an \java.lang.IllegalStateException is thrown.
The test case will complete when all the async objects have their @see \io\vertx\jphp\ext\unit\Async::complete method called at least once.
This method shall be used for creating asynchronous exit points for the executed test.
integer
\io\vertx\jphp\ext\unit\Async
the async instance
verify( $arg0) : $this
Any \java.lang.AssertionError thrown will be caught (and propagated) in order to fulfill potential expected async completeness.
callable
$this
a reference to this, so the API can be used fluently