Special module for using asserts in your tests.
param
$keyparam
$actualparam
$description
param
$keyparam
$actualparam
$description
Checks that array contains subset.
param array
$subsetparam array
$arrayparam bool
$strictparam string
$message
Checks that haystack contains needle
param
$needleparam
$haystackparam string
$message
param
$expectedCountparam
$actualparam
$description
Checks that variable is empty.
param
$actualparam string
$message
Checks that two variables are equal. If you're comparing floating-point values, you can specify the optional "delta" parameter which dictates how great of a precision error are you willing to tolerate in order to consider the two values equal.
Regular example:
<?php
$I->assertEquals($element->getChildrenCount(), 5);
Floating-point example:
<?php
$I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01);
param
$expectedparam
$actualparam string
$messageparam float
$delta
Checks that condition is negative.
param
$conditionparam string
$message
Checks if file exists
param string
$filenameparam string
$message
Checks if file doesn't exist
param string
$filenameparam string
$message
param
$expectedparam
$actualparam
$description
Checks that actual is greater than expected
param
$expectedparam
$actualparam string
$message
Checks that actual is greater or equal than expected
param
$expectedparam
$actualparam string
$message
param
$classparam
$actualparam
$description
param
$typeparam
$actualparam
$description
param
$actualparam
$description
param
$expectedparam
$actualparam
$description
Checks that actual is less than expected
param
$expectedparam
$actualparam string
$message
Checks that actual is less or equal than expected
param
$expectedparam
$actualparam string
$message
Checks that haystack doesn't contain needle.
param
$needleparam
$haystackparam string
$message
Checks that variable is not empty.
param
$actualparam string
$message
Checks that two variables are not equal. If you're comparing floating-point values, you can specify the optional "delta" parameter which dictates how great of a precision error are you willing to tolerate in order to consider the two values not equal.
Regular example:
<?php
$I->assertNotEquals($element->getChildrenCount(), 0);
Floating-point example:
<?php
$I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01);
param
$expectedparam
$actualparam string
$messageparam float
$delta
Checks that the condition is NOT false (everything but false)
param
$conditionparam string
$message
param
$classparam
$actualparam
$description
Checks that variable is not NULL
param
$actualparam string
$message
Checks that string not match with pattern
param string
$patternparam string
$stringparam string
$message
Checks that two variables are not same
param
$expectedparam
$actualparam string
$message
Checks that the condition is NOT true (everything but true)
param
$conditionparam string
$message
Checks that variable is NULL
param
$actualparam string
$message
Checks that string match with pattern
param string
$patternparam string
$stringparam string
$message
Checks that two variables are same
param
$expectedparam
$actualparam string
$message
Checks that a string doesn't start with the given prefix.
param string
$prefixparam string
$stringparam string
$message
Checks that a string starts with the given prefix.
param string
$prefixparam string
$stringparam string
$message
Checks that condition is positive.
param
$conditionparam string
$message
@see expectThrowable @deprecated Use expectThrowable instead.
param
$exception string or \Exceptionparam
$callback
Handles and checks throwables (Exceptions/Errors) called inside the callback function. Either throwable class name or throwable instance should be provided.
<?php
$I->expectThrowable(MyThrowable::class, function() {
$this->doSomethingBad();
});
$I->expectThrowable(new MyException(), function() {
$this->doSomethingBad();
});
If you want to check message or throwable code, you can pass them with throwable instance:
<?php
// will check that throwable MyError is thrown with "Don't do bad things" message
$I->expectThrowable(new MyError("Don't do bad things"), function() {
$this->doSomethingBad();
});
param
$throwable string or \Throwableparam
$callback
Fails the test with message.
param
$message