From 7823af0994e66fbb7e2a7b99dc879e8eaad906fb Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Thu, 12 Apr 2012 00:13:38 +0200 Subject: [PATCH] MDL-32323 tests: check both deletion with truncate and with delete --- lib/ddl/simpletest/testddl.php | 9 ++++++++- lib/ddl/tests/ddl_test.php | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/ddl/simpletest/testddl.php b/lib/ddl/simpletest/testddl.php index 56e45833e5d..3224ecdaa7e 100644 --- a/lib/ddl/simpletest/testddl.php +++ b/lib/ddl/simpletest/testddl.php @@ -1626,7 +1626,14 @@ class ddl_test extends UnitTestCase { $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))); diff --git a/lib/ddl/tests/ddl_test.php b/lib/ddl/tests/ddl_test.php index 73c0401b53f..41bd7293458 100644 --- a/lib/ddl/tests/ddl_test.php +++ b/lib/ddl/tests/ddl_test.php @@ -1600,7 +1600,14 @@ class ddl_testcase extends database_driver_testcase { $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)));