You are here

protected function TestBase::storeAssertion in SimpleTest 8.3

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

self::assert()

1 call to TestBase::storeAssertion()
TestBase::assert in src/TestBase.php
Internal helper: stores the assert.
1 method overrides TestBase::storeAssertion()
InnocuousTest::storeAssertion in tests/src/Kernel/TestDeprecatedTestHooks.php
Override to prevent any assertions from being stored.

File

src/TestBase.php, line 298

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

protected function storeAssertion(array $assertion) {
  return self::getDatabaseConnection()
    ->insert('simpletest', [
    'return' => Database::RETURN_INSERT_ID,
  ])
    ->fields($assertion)
    ->execute();
}