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

PHPUnit does not display all exception data

XMLWordPrintable

    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • MDL-37919-phpunit-exception
    • Hide

      This is pretty tricky to test. I believe it is enough to run phpunit to make sure there is no regression.

      In order to see this in action, you would need to

      1. Write a new unit test
      2. Throw moodle_exception in the test, providing the $a parameter (string or object) together with an non-existing error string.
      Show
      This is pretty tricky to test. I believe it is enough to run phpunit to make sure there is no regression. In order to see this in action, you would need to Write a new unit test Throw moodle_exception in the test, providing the $a parameter (string or object) together with an non-existing error string.

      Let us have moodle_exception thrown during the PHPUnit test. The exception was thrown with additional data passed via the $a parameter. If the exception error string does not exist, the data in the $a parameter are not displayed.

      Normally, when such exception is thrown, the function get_exception_info() appends the contents of the $a placeholder to the exception message. But that function is not used during PHPUnit execution.

      There is already a code that automatically appends the $debuginfo to the message. We need something similar for $a too.

            mudrd8mz David Mudrák (@mudrd8mz)
            mudrd8mz David Mudrák (@mudrd8mz)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Frédéric Massart Frédéric Massart
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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