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

PHPUnit: create_user() generates users with invalid usernames

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.2
    • Fix Version/s: 2.3.3
    • Component/s: Unit tests
    • Labels:

      Description

      calling self::getDataGenerator()->create_user() can generate username as 翔佐藤

      This is not a standard username. It will fail validation against PARAM_USERNAME.

      The bug error is due to the concatenation of firstname /lastname:

      $record['username'] = textlib::strtolower($record['firstname']).textlib::strtolower($record['lastname']);

      A quick fix is to clean_param and to incremente to $username.'XX'. It should be fine as these fake users should be cleaned at the end of the PHPunit tests.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            jerome Jérôme Mouneyrac
            Integrator:
            Dan Poltawski
            Tester:
            Dan Poltawski
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              12/Nov/12