protected function TestBase::storeAssertion in Drupal 8
Helper method to store an assertion record in the configured database.
This method decouples database access from assertion logic.
Parameters
array $assertion: Keyed array representing an assertion, as generated by assert().
Return value
\Drupal\Core\Database\StatementInterface|int|null The message ID.
See also
1 call to TestBase::storeAssertion()
- TestBase::assert in core/
modules/ simpletest/ src/ TestBase.php - Internal helper: stores the assert.
1 method overrides TestBase::storeAssertion()
- InnocuousTest::storeAssertion in core/
modules/ simpletest/ tests/ src/ Kernel/ TestDeprecatedTestHooks.php - Override to prevent any assertions from being stored.
File
- core/
modules/ simpletest/ src/ TestBase.php, line 298
Class
- TestBase
- Base class for Drupal tests.
Namespace
Drupal\simpletestCode
protected function storeAssertion(array $assertion) {
return self::getDatabaseConnection()
->insert('simpletest', [
'return' => Database::RETURN_INSERT_ID,
])
->fields($assertion)
->execute();
}