Moodle
  1. Moodle
  2. MDL-29478

Fix recent regressions & adjust unit tests

    Details

    • Testing Instructions:
      Hide

      Execute under 21_STABLE and master:

      1) Run blog/simpletest/testbloglib.php unittests
      2) TEST: 0 fails and 0 exceptions

      3) Reload the page (F5 or similar). The blog/simpletest/testblog.php unittests will be executed again
      4) TEST: 0 fails and 0 exceptions

      5) Run lib/simpletest/testpagelib_moodlepage.php unittests
      6) TEST: 0 fails and 0 exceptions

      7) Run rating/simpletest/testrating.php unittests
      8) TEST: 0 fails and 0 exceptions

      9) Run ALL unittests
      10) No error related with any of the 3 above should happen

      11) Reload the page (F5 or similar). All the tests will be executed again
      12) No error related with any of the 3 above should happen

      Show
      Execute under 21_STABLE and master: 1) Run blog/simpletest/testbloglib.php unittests 2) TEST: 0 fails and 0 exceptions 3) Reload the page (F5 or similar). The blog/simpletest/testblog.php unittests will be executed again 4) TEST: 0 fails and 0 exceptions 5) Run lib/simpletest/testpagelib_moodlepage.php unittests 6) TEST: 0 fails and 0 exceptions 7) Run rating/simpletest/testrating.php unittests 8) TEST: 0 fails and 0 exceptions 9) Run ALL unittests 10) No error related with any of the 3 above should happen 11) Reload the page (F5 or similar). All the tests will be executed again 12) No error related with any of the 3 above should happen
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      19390

      Description

      Recent changes in code have introduced some minor regressions and/or require changes into unit tests keep all them working.

      This issue will apply the changes necessary to fix all them, each commit one problem.

      Ciao

        Issue Links

          Activity

          Hide
          Eloy Lafuente (stronk7) added a comment -

          There are 4 commits (3 in 21_STABLE) fixing some minor problems. Here they are explained (master hashes):

          635c65bbd5d5543912752a6ed3ece65768de927b - Some tests were failing due to one minor regresion introduced by MDL-29186 (using wrong courseid).

          40a897491518373329d44c9e93de784b23b50ade - Some tests were looking for admin-report-unittest, and this is, since last week one admin-tool and not one admin-report. This commit is master only.

          5169a039c7f2512127ce767f3ddf88762991df8b - Missing include in blog unit tests were causing it dying with fatal error depending if that include was being performed by any other test or no

          e437d9f1d9883fa4ea3929ba43060faccedd26f9 - Fix rating tests so they are not dependent anymore of any cached acceslib information. They were running ok as independent tests but failed when executed together with others, because accesslib_clear_all_caches_for_unit_testing() was invalidating cap checks.

          And that's all. One side conclusion: We need to OOP accesslib ASAP. That way we can hack unittests easily avoiding to create a lot of tables/structures. Alternatively, we can isolate better the cap checks in ratings and other places. But, better if we make accesslib extendible/mockupable.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - There are 4 commits (3 in 21_STABLE) fixing some minor problems. Here they are explained (master hashes): 635c65bbd5d5543912752a6ed3ece65768de927b - Some tests were failing due to one minor regresion introduced by MDL-29186 (using wrong courseid). 40a897491518373329d44c9e93de784b23b50ade - Some tests were looking for admin-report-unittest, and this is, since last week one admin-tool and not one admin-report. This commit is master only. 5169a039c7f2512127ce767f3ddf88762991df8b - Missing include in blog unit tests were causing it dying with fatal error depending if that include was being performed by any other test or no e437d9f1d9883fa4ea3929ba43060faccedd26f9 - Fix rating tests so they are not dependent anymore of any cached acceslib information. They were running ok as independent tests but failed when executed together with others, because accesslib_clear_all_caches_for_unit_testing() was invalidating cap checks. And that's all. One side conclusion: We need to OOP accesslib ASAP. That way we can hack unittests easily avoiding to create a lot of tables/structures. Alternatively, we can isolate better the cap checks in ratings and other places. But, better if we make accesslib extendible/mockupable. Ciao
          Hide
          Sam Hemelryk added a comment -

          Thanks Eloy - this has been integrated now
          (sorry it took a while I got distracted chatting to Petr about webservices)

          Show
          Sam Hemelryk added a comment - Thanks Eloy - this has been integrated now (sorry it took a while I got distracted chatting to Petr about webservices)
          Hide
          Ankit Agarwal added a comment -

          Hi,
          A few tests were marked as "skip", but 0 Exceptions and 0 fail as expected.
          Thanks

          Show
          Ankit Agarwal added a comment - Hi, A few tests were marked as "skip", but 0 Exceptions and 0 fail as expected. Thanks
          Hide
          Eloy Lafuente (stronk7) added a comment -

          yeah, skipped ones are ok (no configured portfolio / webservices / whatever). Thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - yeah, skipped ones are ok (no configured portfolio / webservices / whatever). Thanks!
          Hide
          Aparup Banerjee added a comment -

          fixes have been rolled merrily up the stream! Thanks everybody!

          Show
          Aparup Banerjee added a comment - fixes have been rolled merrily up the stream! Thanks everybody!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: