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

Availability: Date restriction unit test has static data, may break other tests

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1. Download attached file later_test.php and place in /availability/condition/date/tests.
      2. Run vendor/bin/phpunit --testsuite=availability_date_testsuite

      This test should pass. Prior to this fix, the test failed.

      Once finished testing, remember to delete later_test.php.

      Show
      1. Download attached file later_test.php and place in /availability/condition/date/tests. 2. Run vendor/bin/phpunit --testsuite=availability_date_testsuite This test should pass. Prior to this fix, the test failed. Once finished testing, remember to delete later_test.php.
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull Master Branch:
      MDL-51077-master

      Description

      In \availability_date\condition there is a function 'set_current_time_for_test' which is only for use in PHPunit.

      However this sets a static value which is not cleared after the test finishes. As a result, if any future PHPunit test tries to set up something with a date restriction, it may have unexpected behaviour (i.e. the test fails when run as a group, even though it passes individually).

      There are no core tests that break as a result of this, but third-party plugins might do (and we have one that does).

        Attachments

          Activity

            People

            Assignee:
            quen Sam Marshall
            Reporter:
            quen Sam Marshall
            Peer reviewer:
            Tim Hunt
            Integrator:
            David Monllaó
            Tester:
            Adrian Greeve
            Participants:
            Component watchers:
            Sam Marshall, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              14/Sep/15