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

PHPUnit: create_user() generates users with invalid usernames

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.3.3
    • 2.3.2
    • Unit tests

      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.

            skodak Petr Skoda
            jerome Jérôme Mouneyrac
            Dan Poltawski Dan Poltawski
            Dan Poltawski Dan Poltawski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.