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

Migrate all "old" FakeDBUnitTestCase to UnitTestCaseUsingDatabase counterparts

    Details

    • Type: Task
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Unit tests
    • Labels:
    • Difficulty:
      Difficult
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      Some months ago FakeDBUnitTestCase were left nominally out. With that, an important number of tests have remained "hidden" (skipped) since then.

      Since yesterday (Nov 30th 2009), due to MDL-21007, they are, at least, showed as exceptions when running unit tests with message:

      "Unit test XXXX of type FakeDBUnitTestCase no longer supported. Must be migrated to UnitTestCaseUsingDatabase"

      So current tests in core using FakeDBUnitTestCase must be migrated to newer UnitTestCaseUsingDatabase alternative. That includes, at least:

      • grade tests
      • portfolio tests
      • completion and condition tests
      • simpletest tests

      So steps are:

      • Migrate all the tests
      • Document UnitTestCaseUsingDatabase
      • Drop FakeDBUnitTestCase completely from HEAD

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              I've started with grade ones to learn how that is supposed to work.

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - I've started with grade ones to learn how that is supposed to work.
              Hide
              quen Sam Marshall added a comment -

              I changed completionlib - as noted, it didn't even need to be using this class, however there were a couple unrelated failures in unit tests (due to a variable being missing from a fake course-module object) which I fixed.

              I have not done conditionlib yet - if you want me to I probably can

              Show
              quen Sam Marshall added a comment - I changed completionlib - as noted, it didn't even need to be using this class, however there were a couple unrelated failures in unit tests (due to a variable being missing from a fake course-module object) which I fixed. I have not done conditionlib yet - if you want me to I probably can
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              FYI I've just implemented one xmldb_structures cache in install_one_table_from_xmldb_file(), so it only needs to load each xmldb_structure once per request (used to be thousands). 100x speedup for those tests. Ciao

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - FYI I've just implemented one xmldb_structures cache in install_one_table_from_xmldb_file(), so it only needs to load each xmldb_structure once per request (used to be thousands). 100x speedup for those tests. Ciao
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              Yay, all grade tests running (300 tests / 2 fails / 0 exceptions). Only 40 seconds to tun all them (used to be near 40 minutes)

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - Yay, all grade tests running (300 tests / 2 fails / 0 exceptions). Only 40 seconds to tun all them (used to be near 40 minutes)
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              Hi Sam,

              I've already modified conditionlib tests and I'm getting:

              1/1 test cases complete: 50 passes, 4 fails and 0 exceptions.

              Not sure if those 4 fails are really failed tests or it's due to something missing in the "initialisation" code. If so, fill_records() should be the place to insert the missing bits (or another private function if things are different from simply inserting some records).

              Ciao

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - Hi Sam, I've already modified conditionlib tests and I'm getting: 1/1 test cases complete: 50 passes, 4 fails and 0 exceptions. Not sure if those 4 fails are really failed tests or it's due to something missing in the "initialisation" code. If so, fill_records() should be the place to insert the missing bits (or another private function if things are different from simply inserting some records). Ciao
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              Oki, only portfolio ones (15) are pending... Penny have you already done anything? HackFest?I'd want to spend some hours trying to workout a bit the backup/restore docs for 2.0.

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - Oki, only portfolio ones (15) are pending... Penny have you already done anything? HackFest?I'd want to spend some hours trying to workout a bit the backup/restore docs for 2.0.
              Hide
              mjollnir Penny Leach added a comment -

              Not yet I hope to be able to get through these at the hackfest, but probably won't be able to beforehand.

              Show
              mjollnir Penny Leach added a comment - Not yet I hope to be able to get through these at the hackfest, but probably won't be able to beforehand.
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              Ping! Any news on this? Should I send it back to stable backlog so anybody from HQ get it?

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - Ping! Any news on this? Should I send it back to stable backlog so anybody from HQ get it?
              Hide
              skodak Petr Skoda added a comment -

              Hello,

              this should be resolved by the new advanced_testcase implementation that integrates PHPUnit in Moodle 2.3dev. Every test now starts with fresh new installation and developers may freely modify database and all globals + dataroot. Thanks for the report, closing.

              Show
              skodak Petr Skoda added a comment - Hello, this should be resolved by the new advanced_testcase implementation that integrates PHPUnit in Moodle 2.3dev. Every test now starts with fresh new installation and developers may freely modify database and all globals + dataroot. Thanks for the report, closing.

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: