diff options
Diffstat (limited to 'apps/user_ldap/tests/AccessTest.php')
-rw-r--r-- | apps/user_ldap/tests/AccessTest.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index cbb695d779a..336b92af04f 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -632,5 +632,36 @@ class AccessTest extends TestCase { $this->assertSame($expected, $list); } + public function intUsernameProvider() { + // system dependent :-/ + $translitExpected = @iconv('UTF-8', 'ASCII//TRANSLIT', 'fränk') ? 'frank' : 'frnk'; + + return [ + ['alice', 'alice'], + ['b/ob', 'bob'], + ['charly🐬', 'charly'], + ['debo rah', 'debo_rah'], + ['epost@poste.test', 'epost@poste.test'], + ['fränk', $translitExpected], + [' gerda ', 'gerda'], + ['🕱🐵🐘🐑', null] + ]; + } + + /** + * @dataProvider intUsernameProvider + * + * @param $name + * @param $expected + */ + public function testSanitizeUsername($name, $expected) { + if($expected === null) { + $this->expectException(\InvalidArgumentException::class); + } + $sanitizedName = $this->access->sanitizeUsername($name); + $this->assertSame($expected, $sanitizedName); + } + + } |