function LoggingTest::testContribDriverLog
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php \Drupal\KernelTests\Core\Database\LoggingTest::testContribDriverLog()
Tests that a log called by a custom database driver returns proper caller.
@covers ::findCaller
@dataProvider providerContribDriverLog
Parameters
string $driver_namespace: The driver namespace to be tested.
string $stack: A test debug_backtrace stack.
array $expected_entry: The expected stack entry.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ LoggingTest.php, line 158
Class
- LoggingTest
- Tests the query logging facility.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testContribDriverLog($driver_namespace, $stack, array $expected_entry) {
$mock_builder = $this->getMockBuilder(Log::class);
$log = $mock_builder->onlyMethods([
'getDebugBacktrace',
])
->setConstructorArgs([
'test',
])
->getMock();
$log->expects($this->once())
->method('getDebugBacktrace')
->willReturn($stack);
Database::addConnectionInfo('test', 'default', [
'driver' => 'mysql',
'namespace' => $driver_namespace,
]);
$result = $log->findCaller($stack);
$this->assertEquals($expected_entry, $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.