| layout | title |
|---|---|
doc |
Asserts - Codeception - Documentation |
Special module for using asserts in your tests.
param$keyparam$actualparam$description
param$keyparam$actualparam$description
Checks that haystack contains needle
param$needleparam$haystackparam string$message
Checks that variable is empty.
param$actualparam string$message
Checks that two variables are equal.
param$expectedparam$actualparam string$message
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
deprecated
deprecated
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
param$expectedparam$actualparam 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 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$messagereturnmixed|void
Checks that condition is positive.
param$conditionparam string$message
Handles and checks exception called inside callback function. Either exception class name or exception instance should be provided.
{% highlight php %}
expectException(MyException::class, function() { $this->doSomethingBad(); }); $I->expectException(new MyException(), function() { $this->doSomethingBad(); }); {% endhighlight %} If you want to check message or exception code, you can pass them with exception instance: {% highlight php %} expectException(new MyException("Don't do bad things"), function() { $this->doSomethingBad(); }); {% endhighlight %} * `param` $exception string or \Exception * `param` $callback #### fail Fails the test with message. * `param` $message