diff options
Diffstat (limited to 'modules/system/system.test')
-rw-r--r-- | modules/system/system.test | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/modules/system/system.test b/modules/system/system.test index 101390148..d5d95fb69 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -250,7 +250,7 @@ class IPAddressBlockingTestCase extends DrupalWebTestCase { $edit = array(); $edit['ip'] = '192.168.1.1'; $this->drupalPost('admin/settings/ip-blocking', $edit, t('Save')); - $ip = db_result(db_query("SELECT iid from {blocked_ips} WHERE ip = '%s'", $edit['ip'])); + $ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField(); $this->assertNotNull($ip, 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.')); @@ -332,17 +332,29 @@ class CronRunTestCase extends DrupalWebTestCase { // Temporary file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE. $temp_old = file_save_data(''); - db_query('UPDATE {files} SET status = :status, timestamp = :timestamp WHERE fid = :fid', array(':status' => 0, ':timestamp' => 1, ':fid' => $temp_old->fid)); + db_update('files') + ->fields(array( + 'status' => 0, + 'timestamp' => 1, + )) + ->condition('fid', $temp_old->fid) + ->execute(); $this->assertTrue(file_exists($temp_old->filepath), t('Old temp file was created correctly.')); // Temporary file that is less than DRUPAL_MAXIMUM_TEMP_FILE_AGE. $temp_new = file_save_data(''); - db_query('UPDATE {files} SET status = :status WHERE fid = :fid', array(':status' => 0, ':fid' => $temp_new->fid)); + db_update('files') + ->fields(array('status' => 0)) + ->condition('fid', $temp_new->fid) + ->execute(); $this->assertTrue(file_exists($temp_new->filepath), t('New temp file was created correctly.')); // Permanent file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE. $perm_old = file_save_data(''); - db_query('UPDATE {files} SET timestamp = :timestamp WHERE fid = :fid', array(':timestamp' => 1, ':fid' => $perm_old->fid)); + db_update('files') + ->fields(array('timestamp' => 1)) + ->condition('fid', $temp_old->fid) + ->execute(); $this->assertTrue(file_exists($perm_old->filepath), t('Old permanent file was created correctly.')); // Permanent file that is newer than DRUPAL_MAXIMUM_TEMP_FILE_AGE. |