public function ErrorTest::providerTestGetLastCaller in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 40 - Contains \Drupal\Tests\Core\Utility\ErrorTest.
Class
- ErrorTest
- @coversDefaultClass \Drupal\Core\Utility\Error @group Utility
Namespace
Drupal\Tests\Core\UtilityCode
public function providerTestGetLastCaller() {
$data = array();
// Test with just one item. This should default to the function being
// main().
$single_item = array(
$this
->createBacktraceItem(),
);
$data[] = array(
$single_item,
$this
->createBacktraceItem('main()'),
);
// Add a second item, without a class.
$two_items = $single_item;
$two_items[] = $this
->createBacktraceItem('test_function_two');
$data[] = array(
$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[] = array(
$two_items,
$this
->createBacktraceItem('TestClass->test_function_two()'),
);
// Add blacklist functions to backtrace. They should get removed.
foreach (array(
'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[] = array(
$single_item,
$this
->createBacktraceItem('main()'),
);
}
return $data;
}