Skip to content

Commit

Permalink
MDL-32323 tests: check both deletion with truncate and with delete
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Apr 11, 2012
1 parent 5a798e7 commit 7823af0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/ddl/simpletest/testddl.php
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,14 @@ public function test_reset_sequence() {

$record = (object)array('id'=>666, 'course'=>10);
$DB->import_record('testtable', $record);
$DB->delete_records('testtable');
$DB->delete_records('testtable'); // This delete performs one TRUNCATE

$dbman->reset_sequence($table); // using xmldb object
$this->assertEqual(1, $DB->insert_record('testtable', (object)array('course'=>13)));

$record = (object)array('id'=>666, 'course'=>10);
$DB->import_record('testtable', $record);
$DB->delete_records('testtable', array()); // This delete performs one DELETE

$dbman->reset_sequence($table); // using xmldb object
$this->assertEqual(1, $DB->insert_record('testtable', (object)array('course'=>13)));
Expand Down
9 changes: 8 additions & 1 deletion lib/ddl/tests/ddl_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,14 @@ public function test_reset_sequence() {

$record = (object)array('id'=>666, 'course'=>10);
$DB->import_record('testtable', $record);
$DB->delete_records('testtable');
$DB->delete_records('testtable'); // This delete performs one TRUNCATE

$dbman->reset_sequence($table); // using xmldb object
$this->assertEquals(1, $DB->insert_record('testtable', (object)array('course'=>13)));

$record = (object)array('id'=>666, 'course'=>10);
$DB->import_record('testtable', $record);
$DB->delete_records('testtable', array()); // This delete performs one DELETE

$dbman->reset_sequence($table); // using xmldb object
$this->assertEquals(1, $DB->insert_record('testtable', (object)array('course'=>13)));
Expand Down

0 comments on commit 7823af0

Please sign in to comment.