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

Bump to PHPUnit 11

XMLWordPrintable

      HELP!!! You broke my tests!!!

      See the docs for help.

      PR: https://github.com/moodle/devdocs/pull/1234

      Issue description:

      Once all of the preparation tasks are complete we can start to investigate moving to PHPUnit 10+.

      Rather than redirecting the runBare methods as we originally anticipated, we are able to make use of the [\PHPUnit\Framework\Attributes\Before]}} and [\PHPUnit\Framework\Attributes\After]}} attributes to configure this.

      The main issues encountered were:

      • data provider array values must match test method function param names – I originally split this out into a separate issue but quickly realised that this was really tricky to test without the rest of this branch
      • PHPunit no longer fails tests on warnings - this was somewhat more complex to fix
      • PHPUnit Mocking has changed to no longer allow mocking of a destructor. This means that the original destructor is always called.
        As a result of this I had to modify \core\lock\lock to move the current destructor logic to a new release_if_not_released() method which can be mocked and then calling this from the constructor.

      I also had to polyfill some removed test helper methods, including:

      • assertTag
      • getName
      • isInIsolation

      And update tests for changes to:

      • assertEqualsCanonicalizing

      Empty data providers now cause a warning, so some dataProviders which were commented out were instead skipped

      Finally I discovered that while we removed all uses of setMethods in MDL-71036, several had crept back.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Simey Lameze Simey Lameze
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 2 hours, 17 minutes
                2d 2h 17m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.