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

Improve behat exception handling

    • MOODLE_34_STABLE
    • MDL-59773-master
    • Hide

      This issue is mostly self-tested by CI, however the following step must be carried out too:

      1. Apply the attached behat feature to lib/tests/behat
      2. Run behat with tags @mdl59773
        1. Confirm that the test passed
      3. Open lib/sessionlib.php and find the cron_setup_user function.
      4. Add a call to throw new \moodle_exception('You broke it!');
      5. Run behat with tags @mdl59773
        1. Confirm that the test failed
        2. Confirm that a clear stacktrace was present (example below)
      6. Remove the exception and replace it with a call to trigger_error("I made a whoopsy!", E_USER_ERROR);
      7. Run behat with tags @mdl59773
        1. Confirm that a clear stacktrace was present (example below)
          Note: The exception line is shown twice for triggered errors
      Show
      This issue is mostly self-tested by CI, however the following step must be carried out too: Apply the attached behat feature to lib/tests/behat Run behat with tags @mdl59773 Confirm that the test passed Open lib/sessionlib.php and find the cron_setup_user function. Add a call to throw new \moodle_exception('You broke it!'); Run behat with tags @mdl59773 Confirm that the test failed Confirm that a clear stacktrace was present (example below) Remove the exception and replace it with a call to trigger_error("I made a whoopsy!", E_USER_ERROR); Run behat with tags @mdl59773 Confirm that a clear stacktrace was present (example below) Note: The exception line is shown twice for triggered errors

      I've noticed some issues with our ability to detect exceptions in behat which we need to improve:

      1. Edit admin/cron.php and add a call such as:

        throw new \moodle_exception('example');
        

      2. Run a behat step which calls that
      3. Watch it not fail

        1. cron.feature
          0.1 kB
          Andrew Lyons

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

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