ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjUserTest Class Reference
+ Inheritance diagram for ilObjUserTest:
+ Collaboration diagram for ilObjUserTest:

Public Member Functions

 testCreateSetLookupDelete ()
 Creates a user, sets preferences, lookups data, changes password, accept user agreement, delete user.
 testAuthAndEmailMethods ()
 Auth and email related methods.
 testPersonalDesktopItems ()
 Personal Desktop Items.
 testSearch ()
 Search methods.
 testClipboard ()
 Clipboard.
 testMiscellaneous ()
 Miscellaneous.

Protected Member Functions

 setUp ()

Protected Attributes

 $backupGlobals = FALSE

Detailed Description

Definition at line 4 of file ilObjUserTest.php.

Member Function Documentation

ilObjUserTest::setUp ( )
protected

Definition at line 8 of file ilObjUserTest.php.

References ilUnitUtil\performInitialisation().

{
include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
}

+ Here is the call graph for this function:

ilObjUserTest::testAuthAndEmailMethods ( )

Auth and email related methods.

Definition at line 148 of file ilObjUserTest.php.

References $d, ilObjUser\_checkExternalAuthAccount(), ilObjUser\_externalAccountExists(), ilObjUser\_getExternalAccountsByAuthMode(), ilObjUser\_getLocalAccountsForEmail(), ilObjUser\_getLoginAttempts(), ilObjUser\_getNumberOfUsersPerAuthMode(), ilObjUser\_getUserIdsByEmail(), ilObjUser\_incrementLoginAttempts(), ilObjUser\_lookupAuthMode(), ilObjUser\_resetLoginAttempts(), ilObjUser\_setUserInactive(), ilObjUser\_writeAuthMode(), ilObjUser\_writeExternalAccount(), ilObjUser\getUserIdByEmail(), and IL_PASSWD_PLAIN.

{
include_once("./Services/User/classes/class.ilObjUser.php");
$value = "";
// creation
$user = new ilObjUser();
$d = array(
"login" => "aatestuser2",
"passwd_type" => IL_PASSWD_PLAIN,
"passwd" => "password",
"gender" => "f",
"firstname" => "Heidi",
"lastname" => "Kabel",
"email" => "qwe@ty.de",
"ext_account" => "ext_"
);
$user->assignData($d);
$user->setActive(true);
$user->create();
$user->saveAsNew();
$user->setLanguage("de");
$user->writePrefs();
$id = $user->getId();
$ids = ilObjUser::_getUserIdsByEmail("qwe@ty.de");
//var_dump($ids);
if (is_array($ids) && count($ids) == 1 && $ids[0] == "aatestuser2")
{
$value.= "email1-";
}
$uid = ilObjUser::getUserIdByEmail("qwe@ty.de");
if ($uid == $id)
{
$value.= "email2-";
}
foreach ($acc as $k => $v)
if ($k == $id && $v == "ext_kabel")
{
$value.= "auth1-";
}
if (ilObjUser::_lookupAuthMode($id) == "cas")
{
$value.= "auth2-";
}
if (ilObjUser::_checkExternalAuthAccount("cas", "ext_kabel") == "aatestuser2")
{
$value.= "auth3-";
}
if (ilObjUser::_externalAccountExists("ext_kabel","cas"))
{
$value.= "auth4-";
}
// deletion
$user->delete();
$this->assertEquals("email1-email2-auth1-auth2-auth3-auth4-",
$value);
}

+ Here is the call graph for this function:

ilObjUserTest::testClipboard ( )

Clipboard.

Definition at line 317 of file ilObjUserTest.php.

References $d, ilObjUser\_getUsersForClipboadObject(), and IL_PASSWD_PLAIN.

{
$value = "";
// creation
$user = new ilObjUser();
$d = array(
"login" => "aatestuser3",
"passwd_type" => IL_PASSWD_PLAIN,
"passwd" => "password",
"gender" => "f",
"firstname" => "Heidi",
"lastname" => "Kabel",
"email" => "de@de.de"
);
$user->assignData($d);
$user->setActive(true);
$user->create();
$user->saveAsNew();
$user->setLanguage("de");
$user->writePrefs();
$id = $user->getId();
$user->addObjectToClipboard($id, "user", "aatestuser");
$user->addObjectToClipboard(56, "mump", "mumpitz");
if ($user->clipboardHasObjectsOfType("user"))
{
$value.= "clip1-";
}
$user->clipboardDeleteObjectsOfType("user");
if ($user->clipboardHasObjectsOfType("mump") &&
!$user->clipboardHasObjectsOfType("user"))
{
$value.= "clip2-";
}
$objs = $user->getClipboardObjects("mump");
if (is_array($objs) && count($objs) == 1 && $objs[0]["id"] == 56)
{
$value.= "clip3-";
}
$objs = $user->getClipboardChilds(56, "2008-10-10");
if (is_array($us) && count($us) == 1 && $us[0] == $id)
{
$value.= "clip4-";
}
$user->delete();
$this->assertEquals("clip1-clip2-clip3-clip4-",
$value);
}

+ Here is the call graph for this function:

ilObjUserTest::testCreateSetLookupDelete ( )

Creates a user, sets preferences, lookups data, changes password, accept user agreement, delete user.

Definition at line 18 of file ilObjUserTest.php.

References $d, $n, ilObjUser\_checkPassword(), ilObjUser\_hasAcceptedAgreement(), ilObjUser\_loginExists(), ilObjUser\_lookupClientIP(), ilObjUser\_lookupEmail(), ilObjUser\_lookupExternalAccount(), ilObjUser\_lookupFields(), ilObjUser\_lookupGender(), ilObjUser\_lookupId(), ilObjUser\_lookupLanguage(), ilObjUser\_lookupLastLogin(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilObjUser\_lookupPref(), ilObjUser\_readUsersProfileData(), ilObjUser\_toggleActiveStatusOfUsers(), ilObjUser\getStoredActive(), and IL_PASSWD_PLAIN.

{
include_once("./Services/User/classes/class.ilObjUser.php");
// delete all aatestuser from previous runs
while (($i = ilObjUser::_lookupId("aatestuser")) > 0)
{
$user = new ilObjUser($i);
$user->delete();
}
$user = new ilObjUser();
// creation
$d = array(
"login" => "aatestuser",
"passwd_type" => IL_PASSWD_PLAIN,
"passwd" => "password",
"gender" => "m",
"firstname" => "Max",
"lastname" => "Mutzke",
"email" => "de@de.de",
"client_ip" => "1.2.3.4",
"ext_account" => "ext_mutzke"
);
$user->assignData($d);
$user->create();
$user->saveAsNew();
$user->setLanguage("no");
$user->writePrefs();
$id = $user->getId();
$value.= $user->getFirstname()."-";
// update
$user->setFirstname("Maxi");
$user->update();
$value.= $user->getFirstname()."-";
// other update methods
$user->refreshLogin();
// lookups
$value.= ilObjUser::_lookupEmail($id)."-";
$value.= ilObjUser::_lookupGender($id)."-";
$value.= ilObjUser::_lookupClientIP($id)."-";
$value.= $n["lastname"]."-";
$value.= ilObjUser::_lookupLogin($id)."-";
$value.= ilObjUser::_lookupId("aatestuser")."-";
$value.= ilObjUser::_lookupLanguage($id)."-";
if (ilObjUser::_loginExists("aatestuser"))
{
$value.= "le-";
}
// password methods
if (ilObjUser::_checkPassword($id, "password"))
{
$value.= "pw1-";
}
$user->replacePassword(md5("password2"));
if (ilObjUser::_checkPassword($id, "password2"))
{
$value.= "pw2-";
}
$user->updatePassword("password2", "password3", "password3");
if (ilObjUser::_checkPassword($id, "password3"))
{
$value.= "pw3-";
}
$user->resetPassword("password4", "password4");
if (ilObjUser::_checkPassword($id, "password4"))
{
$value.= "pw4-";
}
// preferences...
$user->writePref("testpref", "pref1");
$value.= ilObjUser::_lookupPref($id, "testpref")."-";
$user->deletePref("testpref");
if (ilObjUser::_lookupPref($id, "testpref") == "")
{
$value.= "pref2"."-";
}
// user agreement acceptance
{
$value.= "agr1-";
}
$user->writeAccepted();
{
$value.= "agr2-";
}
// activation
$user->setActive(false);
{
$value.= "act1-";
}
$user->setActive(true);
{
$value.= "act2-";
}
{
$value.= "act3-";
}
// deletion
$user->delete();
$this->assertEquals("Max-Maxi-de@de.de-m-1.2.3.4-Mutzke-aatestuser-ext_mutzke-$id-no-le-".
"pw1-pw2-pw3-pw4-pref1-pref2-agr1-agr2-act1-act2-act3-",
$value);
}

+ Here is the call graph for this function:

ilObjUserTest::testMiscellaneous ( )

Miscellaneous.

Definition at line 378 of file ilObjUserTest.php.

References ilObjUser\_getAllUserAssignedStyles(), ilObjUser\_getNumberOfUsersForStyle(), and ilObjUser\_moveUsersToStyle().

{
$value = "";
include_once("./Services/User/classes/class.ilObjUser.php");
ilObjUser::_moveUsersToStyle("default", "delos", "default", "delos");
$this->assertEquals("",
$value);
}

+ Here is the call graph for this function:

ilObjUserTest::testPersonalDesktopItems ( )

Personal Desktop Items.

Definition at line 228 of file ilObjUserTest.php.

References $d, and IL_PASSWD_PLAIN.

{
include_once("./Services/User/classes/class.ilObjUser.php");
$value = "";
// creation
$user = new ilObjUser();
$d = array(
"login" => "aatestuser3",
"passwd_type" => IL_PASSWD_PLAIN,
"passwd" => "password",
"gender" => "f",
"firstname" => "Heidi",
"lastname" => "Kabel",
"email" => "de@de.de"
);
$user->assignData($d);
$user->setActive(true);
$user->create();
$user->saveAsNew();
$user->setLanguage("de");
$user->writePrefs();
$id = $user->getId();
$user->addDesktopItem(ROOT_FOLDER_ID, "root");
if ($user->isDesktopItem(ROOT_FOLDER_ID, "root"))
{
$value.= "desk1-";
}
$user->setDesktopItemParameters(ROOT_FOLDER_ID, "root", "par1");
$di = $user->getDesktopItems();
if ($item = current($di))
{
if ($item["type"] == "root" && $item["ref_id"] == ROOT_FOLDER_ID)
{
$value.= "desk2-";
}
}
$user->dropDesktopItem(ROOT_FOLDER_ID, "root");
if (!$user->isDesktopItem(ROOT_FOLDER_ID, "root"))
{
$value.= "desk3-";
}
$user->_removeItemFromDesktops(ROOT_FOLDER_ID);
// deletion
$user->delete();
$this->assertEquals("desk1-desk2-desk3-",
$value);
}
ilObjUserTest::testSearch ( )

Search methods.

Definition at line 285 of file ilObjUserTest.php.

References ilObjUser\_getAllUserData(), and ilObjUser\searchUsers().

{
include_once("./Services/User/classes/class.ilObjUser.php");
$value = "";
ilObjUser::searchUsers("test", 1, false, false);
ilObjUser::searchUsers("test", 0, true, false);
ilObjUser::searchUsers("test", 1, false, 1);
ilObjUser::searchUsers("test", 1, false, 2);
ilObjUser::searchUsers("test", 1, false, 3);
ilObjUser::searchUsers("test", 1, false, 4);
ilObjUser::searchUsers("test", 1, false, 5);
ilObjUser::searchUsers("test", 1, false, 6);
ilObjUser::searchUsers("test", 1, false, 7);
ilObjUser::_getAllUserData(array("lastname", "online_time"));
ilObjUser::_getAllUserData(array("lastname", "online_time"), 1);
ilObjUser::_getAllUserData(array("lastname", "online_time"), 2);
ilObjUser::_getAllUserData(array("lastname", "online_time"), 3);
ilObjUser::_getAllUserData(array("lastname", "online_time"), 4);
ilObjUser::_getAllUserData(array("lastname", "online_time"), 5);
ilObjUser::_getAllUserData(array("lastname", "online_time"), 6);
ilObjUser::_getAllUserData(array("lastname", "online_time"), 7);
$this->assertEquals("",
$value);
}

+ Here is the call graph for this function:

Field Documentation

ilObjUserTest::$backupGlobals = FALSE
protected

Definition at line 6 of file ilObjUserTest.php.


The documentation for this class was generated from the following file: