function DatabaseLoggingTestCase::testEnableMultiLogging

Test that we can run two logs in parallel.

File

modules/simpletest/tests/database_test.test, line 3169

Class

DatabaseLoggingTestCase
Query logging tests.

Code

function testEnableMultiLogging() {
    Database::startLog('testing1');
    db_query('SELECT name FROM {test} WHERE age > :age', array(
        ':age' => 25,
    ))->fetchCol();
    Database::startLog('testing2');
    db_query('SELECT age FROM {test} WHERE name = :name', array(
        ':name' => 'Ringo',
    ))->fetchCol();
    $queries1 = Database::getLog('testing1');
    $queries2 = Database::getLog('testing2');
    $this->assertEqual(count($queries1), 2, 'Correct number of queries recorded for log 1.');
    $this->assertEqual(count($queries2), 1, '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.