function ErrorTest::providerTestFormatBacktrace
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Utility/ErrorTest.php \Drupal\Tests\Core\Utility\ErrorTest::providerTestFormatBacktrace()
- 8.9.x core/tests/Drupal/Tests/Core/Utility/ErrorTest.php \Drupal\Tests\Core\Utility\ErrorTest::providerTestFormatBacktrace()
- 11.x core/tests/Drupal/Tests/Core/Utility/ErrorTest.php \Drupal\Tests\Core\Utility\ErrorTest::providerTestFormatBacktrace()
Data provider for testFormatBacktrace.
Return value
array
File
-
core/
tests/ Drupal/ Tests/ Core/ Utility/ ErrorTest.php, line 84
Class
- ErrorTest
- @coversDefaultClass \Drupal\Core\Utility\Error @group Utility
Namespace
Drupal\Tests\Core\UtilityCode
public static function providerTestFormatBacktrace() : array {
$data = [];
// Test with no function, main should be in the backtrace.
$data[] = [
[
self::createBacktraceItem(NULL, NULL),
],
"main() (Line: 10)\n",
];
$base = [
self::createBacktraceItem(),
];
$data[] = [
$base,
"test_function() (Line: 10)\n",
];
// Add a second item.
$second_item = $base;
$second_item[] = self::createBacktraceItem('test_function_2');
$data[] = [
$second_item,
"test_function() (Line: 10)\ntest_function_2() (Line: 10)\n",
];
// Add a second item, with a class.
$second_item_class = $base;
$second_item_class[] = self::createBacktraceItem('test_function_2', 'TestClass');
$data[] = [
$second_item_class,
"test_function() (Line: 10)\nTestClass->test_function_2() (Line: 10)\n",
];
// Add a second item, with a class.
$second_item_args = $base;
$second_item_args[] = self::createBacktraceItem('test_function_2', NULL, [
'string',
10,
new \stdClass(),
]);
$data[] = [
$second_item_args,
"test_function() (Line: 10)\ntest_function_2('string', 10, Object) (Line: 10)\n",
];
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.