Moodle
  1. Moodle
  2. MDL-37919

PHPUnit does not display all exception data

    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: Language, Unit tests
    • Labels:
    • Testing Instructions:
      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.
    • 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:
      MDL-37919-phpunit-exception
    • Rank:
      47675

      Description

      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.

        Activity

        Hide
        David Mudrak added a comment -

        DEAR INTEGRATORS,

        please consider cherry-picking into STABLE branches as well. This may be really useful during the test-driven development and debugging. Thanks in advance. With love, David.

        Show
        David Mudrak added a comment - DEAR INTEGRATORS, please consider cherry-picking into STABLE branches as well. This may be really useful during the test-driven development and debugging. Thanks in advance. With love, David.
        Hide
        Damyon Wiese added a comment -

        The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

        Cheers!

        Show
        Damyon Wiese added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. Cheers!
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Integrated (23, 24 and master), thanks!

        PS: Just guessing if we should add some tests about this somewhere under lib/phpunit/tests. Feel free to create followup issue.

        Show
        Eloy Lafuente (stronk7) added a comment - Integrated (23, 24 and master), thanks! PS: Just guessing if we should add some tests about this somewhere under lib/phpunit/tests. Feel free to create followup issue.
        Hide
        Frédéric Massart added a comment -

        Passing, thanks!

        Show
        Frédéric Massart added a comment - Passing, thanks!
        Hide
        Damyon Wiese added a comment -

        Congratulations this fix has been added to Moodle!

        You may want to dedicate this issue to someone special on this Valentines day.

        Thanks!

        Show
        Damyon Wiese added a comment - Congratulations this fix has been added to Moodle! You may want to dedicate this issue to someone special on this Valentines day. Thanks!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: