Skip to content

Commit

Permalink
MDL-19057 more tests for unlikely id reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Sep 16, 2010
1 parent 4eaa964 commit 27323c9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/dml/simpletest/testdml.php
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,17 @@ public function test_insert_record() {
$before = clone($record);
$DB->insert_record($tablename, $record);
$this->assertEqual($record, $before);

// make sure the id is always increasing and never reuses the same id
$id1 = $DB->insert_record($tablename, array('course' => 3));
$id2 = $DB->insert_record($tablename, array('course' => 3));
$this->assertTrue($id1 < $id2);
$DB->delete_records($tablename, array('id'=>$id2));
$id3 = $DB->insert_record($tablename, array('course' => 3));
$this->assertTrue($id2 < $id3);
$DB->delete_records($tablename, array());
$id4 = $DB->insert_record($tablename, array('course' => 3));
$this->assertTrue($id3 < $id4);
}

public function test_import_record() {
Expand Down

0 comments on commit 27323c9

Please sign in to comment.