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

PHPUnit: create_user() generates users with invalid usernames

    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.

        Gliffy Diagrams

          Activity

          Hide
          skodak Petr Skoda added a comment -

          Thanks for the report.

          Show
          skodak Petr Skoda added a comment - Thanks for the report.
          Hide
          poltawski Dan Poltawski added a comment -

          Integrated, thanks.

          Show
          poltawski Dan Poltawski added a comment - Integrated, thanks.
          Hide
          nebgor Aparup Banerjee added a comment -

          Your issue has dug up some gold.
          It works great i've been told.
          Go forth, be brave, be bold.

          yay! "All your thoughts are belong to everyone."

          Thanks and ciao!

          Show
          nebgor Aparup Banerjee added a comment - Your issue has dug up some gold. It works great i've been told. Go forth, be brave, be bold. yay! "All your thoughts are belong to everyone." Thanks and ciao!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

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