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

Plugins should be able to provide data generators for Behat

    XMLWordPrintable

    Details

      Description

      At the present time, it's not possible for the majority of Moodle's plugin types to provide their own data generators for use in Behat tests. This is a severe hindrance for plugin maintainers – we can't complete our test suites without a fix for this.

      This is because the current behat_data_generators::the_following_exist() implementation uses a hardcoded array of core-supplied data generators (behat_data_generators::$elements).

      Following a forum discussion, I believe that Moodle should provide a new plugin-specific the following "{:frankenstylecomponentname}" "{:elementname}s" exist syntax. The presence of this statement in a scenario would cause Moodle to instantiate the {$frankenstylecomponentname}_generator class and invoke the create_{$elementname} method to create the object.

      Acutally, the final decision for the form the step should take, similar to MDL-66559 and MDL-66335, is

      Given the following "mod_quiz > user overrides" exist:
            | quiz           | user     | attempts |
            | Test quiz name | student1 | 2        |
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                9 Vote for this issue
                Watchers:
                17 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Jan/20

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 56 minutes
                  4h 56m