function LoggingTest::testEnableMultiLogging
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php \Drupal\KernelTests\Core\Database\LoggingTest::testEnableMultiLogging()
- 10 core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php \Drupal\KernelTests\Core\Database\LoggingTest::testEnableMultiLogging()
- 11.x core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php \Drupal\KernelTests\Core\Database\LoggingTest::testEnableMultiLogging()
Tests that we can run two logs in parallel.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ LoggingTest.php, line 49
Class
- LoggingTest
- Tests the query logging facility.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testEnableMultiLogging() {
Database::startLog('testing1');
$this->connection
->query('SELECT name FROM {test} WHERE age > :age', [
':age' => 25,
])
->fetchCol();
Database::startLog('testing2');
$this->connection
->query('SELECT age FROM {test} WHERE name = :name', [
':name' => 'Ringo',
])
->fetchCol();
$queries1 = Database::getLog('testing1');
$queries2 = Database::getLog('testing2');
$this->assertCount(2, $queries1, 'Correct number of queries recorded for log 1.');
$this->assertCount(1, $queries2, 'Correct number of queries recorded for log 2.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.