Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-16140

Table "testtable" already exists messages when re-running dml unit tests after a crash

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.0
    • Database SQL/XMLDB
    • None
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE

    Description

      In order to make this self-healing after a crash, I propose introducing a new method
      private function get_test_table(database_manager $dbman, $tablename) {
      $table = new xmldb_table($tablename);
      if ($dbman->table_exists($table))

      { $dbman->drop_table($table); }

      return $table;
      }
      to be used in lib/dml/simpletest/testdml.php instead of
      $table = new xmldb_table("testtable");

      From Moodle HQ chat: [14:08:25] nicolasconnault: yes, good idea

      Attachments

        Activity

          People

            timhunt Tim Hunt
            timhunt Tim Hunt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              24/Nov/10