ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSessionTest Class Reference
+ Inheritance diagram for ilSessionTest:
+ Collaboration diagram for ilSessionTest:

Public Member Functions

 testBasicSessionBehaviour ()
 IL_Init
 testPasswordAssisstanceSession ()
 IL_Init

Protected Member Functions

 setUp ()

Protected Attributes

 $backupGlobals = FALSE

Detailed Description

Definition at line 24 of file ilSessionTest.php.

Member Function Documentation

ilSessionTest::setUp ( )
protected

Definition at line 28 of file ilSessionTest.php.

{
include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
ilUnitUtil::performInitialisation();
}
ilSessionTest::testBasicSessionBehaviour ( )

IL_Init

Definition at line 37 of file ilSessionTest.php.

References $ilUser, $result, ilSession\_destroy(), ilSession\_destroyByUserId(), ilSession\_destroyExpiredSessions(), ilSession\_duplicate(), ilSession\_exists(), ilSession\_getData(), and ilSession\_writeData().

{
global $ilUser;
include_once("./Services/Authentication/classes/class.ilSession.php");
$result = "";
ilSession::_writeData("123456", "Testdata");
if (ilSession::_exists("123456"))
{
$result.= "exists-";
}
if (ilSession::_getData("123456") == "Testdata")
{
$result.= "write-get-";
}
$duplicate = ilSession::_duplicate("123456");
if (ilSession::_getData($duplicate) == "Testdata")
{
$result.= "duplicate-";
}
if (!ilSession::_exists("123456"))
{
$result.= "destroy-";
}
if (ilSession::_exists($duplicate))
{
$result.= "destroyExp-";
}
ilSession::_destroyByUserId($ilUser->getId());
if (!ilSession::_exists($duplicate))
{
$result.= "destroyByUser-";
}
$this->assertEquals("exists-write-get-duplicate-destroy-destroyExp-destroyByUser-", $result);
}

+ Here is the call graph for this function:

ilSessionTest::testPasswordAssisstanceSession ( )

IL_Init

Definition at line 79 of file ilSessionTest.php.

References $ilUser, $res, $result, db_pwassist_session_destroy(), db_pwassist_session_find(), db_pwassist_session_gc(), db_pwassist_session_read(), and db_pwassist_session_write().

{
global $ilUser;
include_once("./include/inc.pwassist_session_handler.php");
$result = "";
// write session
db_pwassist_session_write("12345", 60, $ilUser->getId());
// find
$res = db_pwassist_session_find($ilUser->getId());
if ($res["pwassist_id"] == "12345")
{
$result.= "find-";
}
// read
$res = db_pwassist_session_read("12345");
if ($res["user_id"] == $ilUser->getId())
{
$result.= "read-";
}
// destroy
$res = db_pwassist_session_read("12345");
if (!$res)
{
$result.= "destroy-";
}
$this->assertEquals("find-read-destroy-", $result);
}

+ Here is the call graph for this function:

Field Documentation

ilSessionTest::$backupGlobals = FALSE
protected

Definition at line 26 of file ilSessionTest.php.


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