Moodle
  1. Moodle
  2. MDL-35854

PHPUnit: create_user() generates users with invalid usernames

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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
          Petr Skoda added a comment -

          Thanks for the report.

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

          Integrated, thanks.

          Show
          Dan Poltawski added a comment - Integrated, thanks.
          Hide
          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
          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: