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

Use API method and trigger event when user is created in unittests and behat

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.8.2
    • 3.9
    • Unit tests

    Description

      When using data generators in behat and unittests, users are not created properly but instead we just insert a record in the database.
      In MDL-59791 Tim also noticed that custom profile fields are not created.

      This issue suggests to use API methods when creating users.

      There can be various things happening in plugins on user creation, in workplace, for example, we allocate to tenants, execute dynamic rules, etc. All this is not possible with the current generator.

      Also I noticed quite a few errors in existing unittests when users are created with invalid data and also deleted users for some reason don't have context. This makes some existing unittests not correct too.

      Attachments

        Issue Links

          Activity

            People

              marina Marina Glancy
              marina Marina Glancy
              Adrian Greeve Adrian Greeve
              CiBoT CiBoT
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Jun/20

                Time Tracking

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