Moodle
  1. Moodle
  2. MDL-35089

PHPUnit execution throwing debugging error on get_fast_modinfo() execution

    Details

    • Testing Instructions:
      Hide

      1) Ensure that both DEBUG_DEVELOPER and display errors are enabled.
      2) Run all phpunit tests (23_STABLE and master)
      3) TEST: Verify there is not any debugging message (+ stack trace) with:

      Debugging: Coding problem - missing course sectioncache property in get_fast_modinfo()
      

      4) TEST: Verify that there is not any failure/exception related with conditions (conditionlib, condition_info_base...) stuff. In fact you should get 100% pass if your DB (mysql, postgres) is properly configured.

      Show
      1) Ensure that both DEBUG_DEVELOPER and display errors are enabled. 2) Run all phpunit tests (23_STABLE and master) 3) TEST: Verify there is not any debugging message (+ stack trace) with: Debugging: Coding problem - missing course sectioncache property in get_fast_modinfo() 4) TEST: Verify that there is not any failure/exception related with conditions (conditionlib, condition_info_base...) stuff. In fact you should get 100% pass if your DB (mysql, postgres) is properly configured.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      43711

      Description

      This was detected when running PHPUnit tests from command line and is caused by new debugging details added to get_fast_modinfo() by MDL-34936.

      Along tests execution there are a bunch of message like this (different is_available() call lines):

      Debugging: Coding problem - missing course sectioncache property in get_fast_modinfo() call
      * line 1208 of /lib/modinfolib.php: call to debugging()
      * line 940 of /lib/conditionlib.php: call to get_fast_modinfo()
      * line 280 of /lib/conditionlib.php: call to condition_info_base->is_available()
      * line 654 of /lib/tests/conditionlib_test.php: call to condition_info_section->is_available()
      * line ? of unknownfile: call to conditionlib_testcase->test_section_is_available()
      

      So I bet tests are missing to pass the corresponding sectioninfo to get_fast_modinfo()

      Ciao

        Issue Links

          Activity

          Hide
          Eloy Lafuente (stronk7) added a comment -

          Aha, found the root cause, there are 2 calls to get_record('course', ...) in lib/conditionlib.php, retrieving "modinfo" but not "sectioncache", later calling get_fast_modinfo().

          So I bet it's ok to add the missing "sectioncache" column, in order to make get_fast_modinfo() happy, and surely, saving extra reconstructions of the 2 caches.

          Doing and testing...

          Show
          Eloy Lafuente (stronk7) added a comment - Aha, found the root cause, there are 2 calls to get_record('course', ...) in lib/conditionlib.php, retrieving "modinfo" but not "sectioncache", later calling get_fast_modinfo(). So I bet it's ok to add the missing "sectioncache" column, in order to make get_fast_modinfo() happy, and surely, saving extra reconstructions of the 2 caches. Doing and testing...
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Assigning this to me and adding Sam as peer reviewer. The change is trivial and tests say it's ok, but for sure he't the best to discover any potential problem.

          Show
          Eloy Lafuente (stronk7) added a comment - Assigning this to me and adding Sam as peer reviewer. The change is trivial and tests say it's ok, but for sure he't the best to discover any potential problem.
          Hide
          Sam Marshall added a comment -

          Yes - thanks for this, that change is correct. (Review pass

          Show
          Sam Marshall added a comment - Yes - thanks for this, that change is correct. (Review pass
          Hide
          Aparup Banerjee added a comment -

          thanks! thats gone now!
          i mean its integrated into master and 23.

          tested: no more sectioncache errs here on pg.

          (still some stats lib ones tho atm)

          Show
          Aparup Banerjee added a comment - thanks! thats gone now! i mean its integrated into master and 23. tested: no more sectioncache errs here on pg. (still some stats lib ones tho atm)
          Hide
          Aparup Banerjee added a comment -

          passed!

          Show
          Aparup Banerjee added a comment - passed!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Many thanks for the hard work.

          These changes have been spread upstream and are already available in the git and cvs repositories.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Many thanks for the hard work. These changes have been spread upstream and are already available in the git and cvs repositories. Ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: