aboutsummaryrefslogtreecommitdiff
path: root/engine/tests/objects
diff options
context:
space:
mode:
authorSteve Clay <steve@mrclay.org>2013-09-20 21:19:06 -0400
committerSteve Clay <steve@mrclay.org>2013-09-20 21:19:06 -0400
commit49ab3a17173aedb8b5e3a2a228cc6cfd0a510e49 (patch)
tree33e1643959f058afa6f601f1c9c19cd0a2a14238 /engine/tests/objects
parentee2b6351f5a759b6e713d3992c3b0c348850fecf (diff)
downloadelgg-49ab3a17173aedb8b5e3a2a228cc6cfd0a510e49.tar.gz
elgg-49ab3a17173aedb8b5e3a2a228cc6cfd0a510e49.tar.bz2
Test that get_user_by_username accepts URL encoded input
Diffstat (limited to 'engine/tests/objects')
-rw-r--r--engine/tests/objects/users.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/engine/tests/objects/users.php b/engine/tests/objects/users.php
index dc9129326..7d2ef6961 100644
--- a/engine/tests/objects/users.php
+++ b/engine/tests/objects/users.php
@@ -159,6 +159,22 @@ class ElggCoreUserTest extends ElggCoreUnitTest {
$this->assertFalse($user);
}
+ public function testGetUserByUsernameAcceptsUrlEncoded() {
+ $username = (string)time();
+ $this->user->username = $username;
+ $guid = $this->user->save();
+
+ // percent encode first letter
+ $first_letter = $username[0];
+ $first_letter = str_pad('%' . dechex(ord($first_letter)), 2, '0', STR_PAD_LEFT);
+ $username = $first_letter . substr($username, 1);
+
+ $user = get_user_by_username($username);
+ $this->assertTrue((bool) $user);
+ $this->assertEqual($guid, $user->guid);
+
+ $this->user->delete();
+ }
public function testElggUserMakeAdmin() {
global $CONFIG;