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

Unit tests on code that sends headers fails due to phpunit_util::bootstrap_moodle_info()

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Deferred
    • 2.8.3
    • None
    • Unit tests
    • MOODLE_28_STABLE
    • Hide

      Adding ob_start(); at the start of phpunit_util::bootstrap_moodle_info(), or just before its called in lib/phpunit/bootstrap.php, allows the tests to run (Although you don't get any output until they've completed as a result).

      Show
      Adding ob_start(); at the start of phpunit_util::bootstrap_moodle_info() , or just before its called in lib/phpunit/bootstrap.php, allows the tests to run (Although you don't get any output until they've completed as a result).
    • Easy

    Description

      Steps to reproduce:

      • Create a PHPUnit test that covers code which calls header()
      • Add the @runInSeparateProcess annotation to the test, which should allow it to run without problems
      • Run the test

      Expected result:

      • Test runs

      Actual Result:

      • Test fails with the message Cannot modify header information - headers already sent by (output started at \path\to\moodle\lib\phpunit\classes\util.php:299)

      Attachments

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              marxjohnson Mark Johnson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: