function SimpletestTestRunResultsStorage::insertLogEntry

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Test/SimpletestTestRunResultsStorage.php \Drupal\Core\Test\SimpletestTestRunResultsStorage::insertLogEntry()

Adds a test log entry for a test run to the storage.

Parameters

\Drupal\Core\Test\TestRun $test_run: The test run object.

array $entry: The array of the log entry elements.

Return value

bool TRUE if the addition was successful, FALSE otherwise.

Overrides TestRunResultsStorageInterface::insertLogEntry

File

core/lib/Drupal/Core/Test/SimpletestTestRunResultsStorage.php, line 81

Class

SimpletestTestRunResultsStorage
Implements a test run results storage compatible with legacy Simpletest.

Namespace

Drupal\Core\Test

Code

public function insertLogEntry(TestRun $test_run, array $entry) : bool {
  $entry['test_id'] = $test_run->id();
  $entry = array_merge([
    'function' => 'Unknown',
    'line' => 0,
    'file' => 'Unknown',
  ], $entry);
  return (bool) $this->connection
    ->insert('simpletest')
    ->fields($entry)
    ->execute();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.