Moodle
  1. Moodle
  2. MDL-37555

Handle CFG->phpunit_dataroot like CFG->dataroot is

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.4, 2.4.1, 2.5
    • Fix Version/s: 2.3.5, 2.4.2
    • Component/s: Unit tests
    • Labels:
      None
    • Testing Instructions:
      Hide

      0. Setup your site so you make $CFG->phpunit_dataroot to point to one link to a real directory (unix/mac required?)

      a. Running:

      phpunit moodlelib_testcase lib/tests/moodlelib_test.php

      should be enough as far as it includes 1 assertion checking for this.

      b. Running all tests will confirm nothing else breaks with the changes.

      1. Repeat a & b with $CFG->phpunit_dataroot pointing to a real directory.

      That is, ciao

      Show
      0. Setup your site so you make $CFG->phpunit_dataroot to point to one link to a real directory (unix/mac required?) a. Running: phpunit moodlelib_testcase lib/tests/moodlelib_test.php should be enough as far as it includes 1 assertion checking for this. b. Running all tests will confirm nothing else breaks with the changes. 1. Repeat a & b with $CFG->phpunit_dataroot pointing to a real directory. That is, ciao
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      47206

      Description

      When running unittests it should be always true that:

      CFG->phpunit_dataroot === CFG->dataroot

      but this has been detected to fail sometimes (see MDL-34344 failing tests).

      The ultimate reason seems to be that we always realpath(CFG->dataroot) but don't do the same with CFG->phpunit_dataroot.

      So this is a proposal to, simply, apply the realpath() to CFG->phpunit_dataroot to ensure that the equality above always works.

        Issue Links

          Activity

          Hide
          Petr Škoda added a comment -

          +1

          Show
          Petr Škoda added a comment - +1
          Hide
          Eloy Lafuente (stronk7) added a comment -

          (thanks!)

          Show
          Eloy Lafuente (stronk7) added a comment - (thanks!)
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated (23, 24 & master), thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated (23, 24 & master), thanks!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Passing, all unit tests completed without problem, both locally and the 2 CI ones.

          Show
          Eloy Lafuente (stronk7) added a comment - Passing, all unit tests completed without problem, both locally and the 2 CI ones.
          Hide
          Dan Poltawski added a comment -

          Hurray! We did it! Thanks to all the reporters, testers, user and watchers for a bumper week of Moodling!

          Show
          Dan Poltawski added a comment - Hurray! We did it! Thanks to all the reporters, testers, user and watchers for a bumper week of Moodling!
          Hide
          Petr Škoda added a comment -

          oh, this created a regression - the test dataroot is not created any more because the realpath() returns false for non-existent dirs.

          Either we should move the mkdir() or remove it completely...

          Show
          Petr Škoda added a comment - oh, this created a regression - the test dataroot is not created any more because the realpath() returns false for non-existent dirs. Either we should move the mkdir() or remove it completely...

            People

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

              Dates

              • Created:
                Updated:
                Resolved: