ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSessionTest Class Reference

Class ilSessionTest needsInstalledILIAS. More...

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

Public Member Functions

 testBasicSessionBehaviour ()
 IL_Init More...
 
 testPasswordAssisstanceSession ()
 IL_Init More...
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Class ilSessionTest needsInstalledILIAS.

Definition at line 30 of file ilSessionTest.php.

Member Function Documentation

◆ setUp()

ilSessionTest::setUp ( )
protected

Definition at line 34 of file ilSessionTest.php.

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

◆ testBasicSessionBehaviour()

ilSessionTest::testBasicSessionBehaviour ( )

IL_Init

Definition at line 43 of file ilSessionTest.php.

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

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

◆ testPasswordAssisstanceSession()

ilSessionTest::testPasswordAssisstanceSession ( )

IL_Init

Definition at line 81 of file ilSessionTest.php.

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().

82  {
83  global $DIC;
84 
85  $ilUser = $DIC['ilUser'];
86 
87  include_once("./include/inc.pwassist_session_handler.php");
88 
89  $result = "";
90 
91  // write session
92  db_pwassist_session_write("12345", 60, $ilUser->getId());
93 
94  // find
96  if ($res["pwassist_id"] == "12345") {
97  $result .= "find-";
98  }
99 
100  // read
101  $res = db_pwassist_session_read("12345");
102  if ($res["user_id"] == $ilUser->getId()) {
103  $result .= "read-";
104  }
105 
106  // destroy
108  $res = db_pwassist_session_read("12345");
109  if (!$res) {
110  $result .= "destroy-";
111  }
112 
114 
115  $this->assertEquals("find-read-destroy-", $result);
116  }
db_pwassist_session_destroy($pwassist_id)
destroy session
$result
db_pwassist_session_read($pwassist_id)
db_pwassist_session_find($user_id)
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
db_pwassist_session_gc()
removes all expired sessions
$ilUser
Definition: imgupload.php:18
db_pwassist_session_write($pwassist_id, $maxlifetime, $user_id)
Writes serialized session data to the database.
+ Here is the call graph for this function:

Field Documentation

◆ $backupGlobals

ilSessionTest::$backupGlobals = false
protected

Definition at line 32 of file ilSessionTest.php.


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