diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test index 76ca103..03f2d18 100644 --- a/modules/simpletest/tests/database_test.test +++ b/modules/simpletest/tests/database_test.test @@ -719,6 +719,21 @@ class DatabaseUpdateTestCase extends DatabaseTestCase { } /** + * Confirm that we can update the primary key of a record successfully. + * Bug: http://drupal.org/node/1266572 + */ + function testPrimaryKeyUpdate() { + $num_updated = db_update('test') + ->fields(array('id' => 42, 'name' => 'John')) + ->condition('id', 1) + ->execute(); + $this->assertIdentical($num_updated, 1, t('Updated 1 record.')); + + $saved_name= db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 42))->fetchField(); + $this->assertIdentical($saved_name, 'John', t('Updated primary key successfully.')); + } + + /** * Confirm updating to NULL. */ function testSimpleNullUpdate() {