You are here

protected function TestBase::storeAssertion in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/TestBase.php \Drupal\simpletest\TestBase::storeAssertion()

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 core/modules/simpletest/src/TestBase.php
Internal helper: stores the assert.

File

core/modules/simpletest/src/TestBase.php, line 366
Contains \Drupal\simpletest\TestBase.

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();
}