public function ErrorTest::providerTestFormatBacktrace in Drupal 8
Same name and namespace in other branches
- 9 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 82
Class
- ErrorTest
- @coversDefaultClass \Drupal\Core\Utility\Error @group Utility
Namespace
Drupal\Tests\Core\UtilityCode
public function providerTestFormatBacktrace() {
$data = [];
// Test with no function, main should be in the backtrace.
$data[] = [
[
$this
->createBacktraceItem(NULL, NULL),
],
"main() (Line: 10)\n",
];
$base = [
$this
->createBacktraceItem(),
];
$data[] = [
$base,
"test_function() (Line: 10)\n",
];
// Add a second item.
$second_item = $base;
$second_item[] = $this
->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[] = $this
->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[] = $this
->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;
}