aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/tests
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-03-02 17:44:06 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-03-02 17:44:06 +0100
commit8607992e85531956f8274efd1fa6bd4587ea6a39 (patch)
tree295f7862bf9d0388839afea99ba9f3e46ddd5c10 /apps/user_ldap/tests
parent1953a11dfa84611cf6a70ecf4d057072f54b0f64 (diff)
downloadnextcloud-server-8607992e85531956f8274efd1fa6bd4587ea6a39.tar.gz
nextcloud-server-8607992e85531956f8274efd1fa6bd4587ea6a39.zip
do not create empty userid when attribute does not have allowed chars
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r--apps/user_ldap/tests/AccessTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index cbb695d779a..c52b8e6611b 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -632,5 +632,33 @@ class AccessTest extends TestCase {
$this->assertSame($expected, $list);
}
+ public function intUsernameProvider() {
+ return [
+ ['alice', 'alice'],
+ ['b/ob', 'bob'],
+ ['charly🐬', 'charly'],
+ ['debo rah', 'debo_rah'],
+ ['epost@poste.test', 'epost@poste.test'],
+ ['fränk', 'frank'],
+ [' 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);
+ }
+
+
}