You are here

protected function ErrorTest::createBacktraceItem in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Utility/ErrorTest.php \Drupal\Tests\Core\Utility\ErrorTest::createBacktraceItem()

Creates a mock backtrace item.

Parameters

string|NULL $function: (optional) The function name to use in the backtrace item.

string $class: (optional) The class to use in the backtrace item.

array $args: (optional) An array of function arguments to add to the backtrace item.

Return value

array A backtrace array item.

2 calls to ErrorTest::createBacktraceItem()
ErrorTest::providerTestFormatBacktrace in core/tests/Drupal/Tests/Core/Utility/ErrorTest.php
Data provider for testFormatBacktrace.
ErrorTest::providerTestGetLastCaller in core/tests/Drupal/Tests/Core/Utility/ErrorTest.php
Data provider for testGetLastCaller.

File

core/tests/Drupal/Tests/Core/Utility/ErrorTest.php, line 131
Contains \Drupal\Tests\Core\Utility\ErrorTest.

Class

ErrorTest
@coversDefaultClass \Drupal\Core\Utility\Error @group Utility

Namespace

Drupal\Tests\Core\Utility

Code

protected function createBacktraceItem($function = 'test_function', $class = NULL, array $args = array()) {
  $backtrace = array(
    'file' => 'test_file',
    'line' => 10,
    'function' => $function,
    'args' => array(),
  );
  if (isset($class)) {
    $backtrace['class'] = $class;
    $backtrace['type'] = '->';
  }
  if (!empty($args)) {
    $backtrace['args'] = $args;
  }
  return $backtrace;
}