summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-02-27 18:13:58 -0500
committerDavid Rothstein <drothstein@gmail.com>2013-02-27 18:13:58 -0500
commitbfaa7b4fd0c0b16e38ba3475d0be24b1d5f9a5d1 (patch)
tree9d8535813b13185b6869278f32c6b0c6e619a931 /modules/simpletest
parent297665a47120ae533aa1bbde1de9cb1227e7c6bf (diff)
downloadbrdo-bfaa7b4fd0c0b16e38ba3475d0be24b1d5f9a5d1.tar.gz
brdo-bfaa7b4fd0c0b16e38ba3475d0be24b1d5f9a5d1.tar.bz2
Issue #1266572 by znerol, joshf: Fixed Workaround in UpdateQuery_sqlite() for affected rows count causes certain updates to be suppressed.
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/tests/database_test.test14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test
index e7ce14f7a..b58578e99 100644
--- a/modules/simpletest/tests/database_test.test
+++ b/modules/simpletest/tests/database_test.test
@@ -848,6 +848,20 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->execute();
$this->assertIdentical($num_rows, 3, 'Number of affected rows are returned.');
}
+
+ /**
+ * Confirm that we can update the primary key of a record successfully.
+ */
+ function testPrimaryKeyUpdate() {
+ $num_updated = db_update('test')
+ ->fields(array('id' => 42, 'name' => 'John'))
+ ->condition('id', 1)
+ ->execute();
+ $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
+
+ $saved_name= db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 42))->fetchField();
+ $this->assertIdentical($saved_name, 'John', 'Updated primary key successfully.');
+ }
}
/**