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

core_renderer_cli uses HTML footer

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.8, 2.8
    • Fix Version/s: 2.8
    • Component/s: Libraries
    • Labels:

      Description

      When rendering a page from a CLI, footer produces a coding exception as the page is not in the correct state for footer closure;

      1) mod_mailassess_view_testcase::test_first_screen_display
      coding_exception: Coding error detected, it must be fixed by a programmer: Invalid state passed to moodle_page::set_state. We are in state 0 and state 3 was requested.
       
      /Users/russell.smith/IdeaProjects/lms/moodle/lib/pagelib.php:841
      /Users/russell.smith/IdeaProjects/lms/moodle/lib/outputrenderers.php:901
      /Users/russell.smith/IdeaProjects/lms/moodle/mod/mailassess/view.php:114
      /Users/russell.smith/IdeaProjects/lms/moodle/mod/mailassess/tests/view_test.php:52
      /Users/russell.smith/IdeaProjects/lms/moodle/lib/phpunit/classes/advanced_testcase.php:76
      

      This is caused by the core_renderer_cli using the html version of the footer function. So a CLI page cannot call the footer() function as it will error.

      The use-case for me it mocking up sufficient information to test the view.php page of a module. Given certain inputs it should behave in a certain way.

      In terms of reproduction;
      1. Create a unit test that will call a modules view.php file. This will require including a number of global variables and force setting $_GET.
      2. Run the unit test. The failure will occur.

      Applying the attached patch will produce the expected output.

        Attachments

          Activity

            People

            Assignee:
            mr-russ Russell Smith
            Reporter:
            mr-russ Russell Smith
            Integrator:
            Damyon Wiese
            Tester:
            Damyon Wiese
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/Nov/14