You are here

function simpletest_insert_assert in Drupal 8

Store an assertion from outside the testing context.

This is useful for inserting assertions that can only be recorded after the test case has been destroyed, such as PHP fatal errors. The caller information is not automatically gathered since the caller is most likely inserting the assertion on behalf of other code. In all other respects the method behaves just like \Drupal\simpletest\TestBase::assert() in terms of storing the assertion.

Parameters

string $test_id: The test ID to which the assertion relates.

string $test_class: The test class to store an assertion for.

bool|string $status: A boolean or a string of 'pass' or 'fail'. TRUE means 'pass'.

string $message: The assertion message.

string $group: The assertion message group.

array $caller: The an array containing the keys 'file' and 'line' that represent the file and line number of that file that is responsible for the assertion.

Return value

Message ID of the stored assertion.

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\TestDatabase::insertAssert() instead.

See also

https://www.drupal.org/node/3075252

File

core/modules/simpletest/simpletest.module, line 499
Provides testing functionality.

Code

function simpletest_insert_assert($test_id, $test_class, $status, $message = '', $group = 'Other', array $caller = []) {
  @trigger_error(__FUNCTION__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \\Drupal\\Core\\Test\\TestDatabase::insertAssert() instead. See https://www.drupal.org/node/3075252', E_USER_DEPRECATED);
  TestDatabase::insertAssert($test_id, $test_class, $status, $message, $group, $caller);
}