ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSessionTest Class Reference

Class ilSessionTest @group needsInstalledILIAS. More...

+ Inheritance diagram for ilSessionTest:
+ Collaboration diagram for ilSessionTest:

Public Member Functions

 testBasicSessionBehaviour ()
 @group IL_Init More...
 
 testPasswordAssisstanceSession ()
 @group IL_Init More...
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Class ilSessionTest @group needsInstalledILIAS.

Definition at line 28 of file ilSessionTest.php.

Member Function Documentation

◆ setUp()

ilSessionTest::setUp ( )
protected

Definition at line 32 of file ilSessionTest.php.

33 {
34 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
35 ilUnitUtil::performInitialisation();
36 }

◆ testBasicSessionBehaviour()

ilSessionTest::testBasicSessionBehaviour ( )

@group IL_Init

Definition at line 41 of file ilSessionTest.php.

42 {
43 global $DIC;
44
45 $ilUser = $DIC['ilUser'];
46
47 include_once("./Services/Authentication/classes/class.ilSession.php");
48 $result = "";
49 ilSession::_writeData("123456", "Testdata");
50 if (ilSession::_exists("123456")) {
51 $result .= "exists-";
52 }
53 if (ilSession::_getData("123456") == "Testdata") {
54 $result .= "write-get-";
55 }
56 $duplicate = ilSession::_duplicate("123456");
57 if (ilSession::_getData($duplicate) == "Testdata") {
58 $result .= "duplicate-";
59 }
60 ilSession::_destroy("123456");
61 if (!ilSession::_exists("123456")) {
62 $result .= "destroy-";
63 }
65 if (ilSession::_exists($duplicate)) {
66 $result .= "destroyExp-";
67 }
68
70 if (!ilSession::_exists($duplicate)) {
71 $result .= "destroyByUser-";
72 }
73 $this->assertEquals("exists-write-get-duplicate-destroy-destroyExp-destroyByUser-", $result);
74 }
$result
static _exists($a_session_id)
Check whether session exists.
static _writeData($a_session_id, $a_data)
Write session data.
static _destroyExpiredSessions()
Destroy expired sessions.
static _destroy($a_session_id, $a_closing_context=null, $a_expired_at=null)
Destroy session.
static _destroyByUserId($a_user_id)
Destroy session.
static _getData($a_session_id)
Get session data from table.
static _duplicate($a_session_id)
Duplicate session.
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18

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

+ Here is the call graph for this function:

◆ testPasswordAssisstanceSession()

ilSessionTest::testPasswordAssisstanceSession ( )

@group IL_Init

Definition at line 79 of file ilSessionTest.php.

80 {
81 global $DIC;
82
83 $ilUser = $DIC['ilUser'];
84
85 include_once("./include/inc.pwassist_session_handler.php");
86
87 $result = "";
88
89 // write session
90 db_pwassist_session_write("12345", 60, $ilUser->getId());
91
92 // find
94 if ($res["pwassist_id"] == "12345") {
95 $result .= "find-";
96 }
97
98 // read
100 if ($res["user_id"] == $ilUser->getId()) {
101 $result .= "read-";
102 }
103
104 // destroy
107 if (!$res) {
108 $result .= "destroy-";
109 }
110
112
113 $this->assertEquals("find-read-destroy-", $result);
114 }
db_pwassist_session_destroy($pwassist_id)
destroy session
db_pwassist_session_find($user_id)
db_pwassist_session_write($pwassist_id, $maxlifetime, $user_id)
Writes serialized session data to the database.
db_pwassist_session_read($pwassist_id)
db_pwassist_session_gc()
removes all expired sessions
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:

Field Documentation

◆ $backupGlobals

ilSessionTest::$backupGlobals = false
protected

Definition at line 30 of file ilSessionTest.php.


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