1 database_test.test DatabaseLoggingTestCase::testEnableMultiLogging()

Test that we can run two logs in parallel.

File

core/modules/simpletest/tests/database_test.test, line 2864
Database tests.

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.');
}