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

PHPUnit: Put debugging messages with the error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.8.9, 2.9.4, 3.0.2
    • Fix Version/s: None
    • Component/s: Unit tests
    • Testing Instructions:
      Hide

      Add a debugging() call to any test and run that test or test suite. After the fix, the debugging message should be reported with the test in the PHPUnit report.

      Show
      Add a debugging() call to any test and run that test or test suite. After the fix, the debugging message should be reported with the test in the PHPUnit report.
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE

      Description

      Currently, when there is a debugging message emitted during a test, the debugging message is printed to the screen and then a separate message is sent via trigger_error to fail the test. The debugging message(s) should be included with the message for trigger_error as it helps with several things:

      • Debugging messages are no longer printed in the PHPUnit progress bar (at least if it happens during a test).
      • The debugging message is actually associated to the test in the PHPUnit report. This works for the text format or for JUnit format which is used on CI. Without this, you cannot tell which debugging message goes with which test and you must look at the logs for the message itself. This helps a lot with CI builds.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              bushido Mark Nielsen
              Participants:
              Component watchers:
              Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: