ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 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 ( )

IL_Init

Definition at line 41 of file ilSessionTest.php.

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

42  {
43  global $ilUser;
44 
45  include_once("./Services/Authentication/classes/class.ilSession.php");
46  $result = "";
47  ilSession::_writeData("123456", "Testdata");
48  if (ilSession::_exists("123456")) {
49  $result.= "exists-";
50  }
51  if (ilSession::_getData("123456") == "Testdata") {
52  $result.= "write-get-";
53  }
54  $duplicate = ilSession::_duplicate("123456");
55  if (ilSession::_getData($duplicate) == "Testdata") {
56  $result.= "duplicate-";
57  }
58  ilSession::_destroy("123456");
59  if (!ilSession::_exists("123456")) {
60  $result.= "destroy-";
61  }
63  if (ilSession::_exists($duplicate)) {
64  $result.= "destroyExp-";
65  }
66 
67  ilSession::_destroyByUserId($ilUser->getId());
68  if (!ilSession::_exists($duplicate)) {
69  $result.= "destroyByUser-";
70  }
71  $this->assertEquals("exists-write-get-duplicate-destroy-destroyExp-destroyByUser-", $result);
72  }
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.
$ilUser
Definition: imgupload.php:18
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.
+ Here is the call graph for this function:

◆ testPasswordAssisstanceSession()

ilSessionTest::testPasswordAssisstanceSession ( )

IL_Init

Definition at line 77 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().

78  {
79  global $ilUser;
80 
81  include_once("./include/inc.pwassist_session_handler.php");
82 
83  $result = "";
84 
85  // write session
86  db_pwassist_session_write("12345", 60, $ilUser->getId());
87 
88  // find
89  $res = db_pwassist_session_find($ilUser->getId());
90  if ($res["pwassist_id"] == "12345") {
91  $result.= "find-";
92  }
93 
94  // read
95  $res = db_pwassist_session_read("12345");
96  if ($res["user_id"] == $ilUser->getId()) {
97  $result.= "read-";
98  }
99 
100  // destroy
102  $res = db_pwassist_session_read("12345");
103  if (!$res) {
104  $result.= "destroy-";
105  }
106 
108 
109  $this->assertEquals("find-read-destroy-", $result);
110  }
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
$ilUser
Definition: imgupload.php:18
db_pwassist_session_gc()
removes all expired sessions
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 30 of file ilSessionTest.php.


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