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

The function moodleform::mock_submit() in formslib.php does not work if form uses namespace.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0.4
    • 3.1.4, 3.2.1
    • Forms Library
    • MOODLE_30_STABLE
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MDL-56233-32-mocksubmit
    • Hide

      A) Provide the $formidentifier instead of auto-detecting it.

      B) Not using mock_submit and creating $_POST data in your code.

      Show
      A) Provide the $formidentifier instead of auto-detecting it. B) Not using mock_submit and creating $_POST data in your code.
    • Easy
    • Hide

      Run the testcase: lib/tests/formslib_test.php

      Show
      Run the testcase: lib/tests/formslib_test.php

    Description

      In formslib.php , the function moodleform::mock_submit() uses a $formidentifier that can be auto-detected.

      If the plugin is using namespaces instead of frankenstyle class name, get_called_class() will return 'type\name' instead of 'type_name'. The mocking does not work properly when it auto-detects the name.

      Please check my proposed solution branch for a unit test isolating the issue.

      Attachments

        Activity

          People

            roperto Daniel Thee Roperto
            roperto Daniel Thee Roperto
            Frédéric Massart Frédéric Massart
            Dan Poltawski Dan Poltawski
            Ankit Agarwal Ankit Agarwal
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9/Jan/17