diff options
Diffstat (limited to 'modules/statistics/statistics.test')
-rw-r--r-- | modules/statistics/statistics.test | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/modules/statistics/statistics.test b/modules/statistics/statistics.test index a40e18c96..c79cfde0d 100644 --- a/modules/statistics/statistics.test +++ b/modules/statistics/statistics.test @@ -17,7 +17,18 @@ class StatisticsBlockVisitorsTestCase extends DrupalWebTestCase { $this->blocking_user = $this->drupalCreateUser(array('block IP addresses', 'access statistics')); // Insert dummy access by anonymous user into access log. - db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", 'test', 'node/1', 'http://example.com', '192.168.1.1', '0', '10', '10', REQUEST_TIME); + db_insert('accesslog') + ->fields(array( + 'title' => 'test', + 'path' => 'node/1', + 'url' => 'http://example.com', + 'hostname' => '192.168.1.1', + 'uid' => 0, + 'sid' => 10, + 'timer' => 10, + 'timestamp' => REQUEST_TIME, + )) + ->execute(); } /** @@ -43,8 +54,8 @@ class StatisticsBlockVisitorsTestCase extends DrupalWebTestCase { $edit = array(); $edit['ip'] = $test_ip_address; $this->drupalPost('admin/settings/ip-blocking', $edit, t('Save')); - $ip = db_result(db_query("SELECT iid from {blocked_ips} WHERE ip = '%s'", $edit['ip'])); - $this->assertNotNull($ip, t('IP address found in database')); + $ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField(); + $this->assertNotEqual($ip, FALSE, t('IP address found in database')); $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), t('IP address was blocked.')); // Verify that the block/unblock link on the top visitors page has been altered. |