public function ErrorTest::providerTestGetLastCaller in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Utility/ErrorTest.php \Drupal\Tests\Core\Utility\ErrorTest::providerTestGetLastCaller()
Data provider for testGetLastCaller.
Return value
array An array of parameter data.
File
- core/
tests/ Drupal/ Tests/ Core/ Utility/ ErrorTest.php, line 34
Class
- ErrorTest
- @coversDefaultClass \Drupal\Core\Utility\Error @group Utility
Namespace
Drupal\Tests\Core\UtilityCode
public function providerTestGetLastCaller() {
$data = [];
// Test with just one item. This should default to the function being
// main().
$single_item = [
$this
->createBacktraceItem(),
];
$data[] = [
$single_item,
$this
->createBacktraceItem('main()'),
];
// Add a second item, without a class.
$two_items = $single_item;
$two_items[] = $this
->createBacktraceItem('test_function_two');
$data[] = [
$two_items,
$this
->createBacktraceItem('test_function_two()'),
];
// Add a second item, with a class.
$two_items = $single_item;
$two_items[] = $this
->createBacktraceItem('test_function_two', 'TestClass');
$data[] = [
$two_items,
$this
->createBacktraceItem('TestClass->test_function_two()'),
];
// Add blacklist functions to backtrace. They should get removed.
foreach ([
'debug',
'_drupal_error_handler',
'_drupal_exception_handler',
] as $function) {
$two_items = $single_item;
// Push to the start of the backtrace.
array_unshift($two_items, $this
->createBacktraceItem($function));
$data[] = [
$single_item,
$this
->createBacktraceItem('main()'),
];
}
return $data;
}