From cbb639a16ffec82f498ae689818b010e040bf5b4 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Fri, 5 Sep 2008 19:04:26 +0000 Subject: #298444 by c960657: Fix exceptions in DBLog test. --- modules/dblog/dblog.test | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test index 258e46601..376e0e2be 100644 --- a/modules/dblog/dblog.test +++ b/modules/dblog/dblog.test @@ -211,19 +211,14 @@ class DBLogTestCase extends DrupalWebTestCase { $count = db_result(db_query('SELECT COUNT(wid) FROM {watchdog} WHERE uid = %d', $user->uid)); $this->assertTrue($count == 0, t('DBLog contains @count records for @name', array('@count' => $count, '@name' => $user->name))); - // Fetch row ids in watchdog that previously related to the deleted user. + // Count rows in watchdog that previously related to the deleted user. $select = db_select('watchdog'); - $select->addField('watchdog', 'wid'); + $select->addExpression('COUNT(*)'); $select->condition('uid', 0); if ($ids) { $select->condition('wid', $ids, 'IN'); } - $result = $select->execute(); - unset($ids); - foreach ($result as $row) { - $ids[] = $row->wid; - } - $count_after = (isset($ids)) ? count($ids) : 0; + $count_after = $select->execute()->fetchField(); $this->assertTrue($count_after == $count_before, t('DBLog contains @count records for @name that now have uid = 0', array('@count' => $count_before, '@name' => $user->name))); unset($ids); // Fetch row ids in watchdog that relate to the user. -- cgit v1.2.3