I am using Codeception for testing a REST API developed by Laravel.
I use seeRecord method like this for testing value of a columns:
$I->seeRecord('organisations', ['id' => $id, 'first_name' => $value]);
But what the seeRecord
does is testing equality. However in some cases I need to test the contents and not the equality, something like:
WHERE columnX like %value%
It seems I can do it with the third parameter of the seeRecord
which is [Part] orm
while I couldn't find any documentation or sample for that.
Any idea that how can I check the record for like
operator?
[Part] orm
is not a parameter, it means that it is possible to import only that part of the module (ORM methods) to actor class.
The only way to use different comparison functions with data is to fetch the record and use assertions from Asserts module.
$org = $I->grabRecord('organisations', ['id' => $id]);
$I->assertStringContainsString('value', $org['first_name'], 'First name doesnt contain value');
When I use this function I receive the following error:
[RuntimeException] Call to undefined method ApiTester::assertStringContainsString
I tested
assertStringContainsStringIgnoringCase
function also and it is also is not defined and also not documented in their website. Maybe deprecated?Enable Asserts module in api.suite.yaml