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

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.8.2
    • Fix Version/s: 3.9
    • Component/s: 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

              Assignee:
              marina Marina Glancy
              Reporter:
              marina Marina Glancy
              Integrator:
              Adrian Greeve
              Tester:
              CiBoT
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                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