ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSessionTest Class Reference

Class ilSessionTest. More...

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

Public Member Functions

 testPasswordAssisstanceSession ()
 

Protected Member Functions

 setUp ()
 
 setGlobalVariable (string $name, $value)
 

Detailed Description

Class ilSessionTest.

Definition at line 30 of file ilSessionTest.php.

Member Function Documentation

◆ setGlobalVariable()

ilSessionTest::setGlobalVariable ( string  $name,
  $value 
)
protected
Parameters
string$name
mixed$value

Definition at line 65 of file ilSessionTest.php.

References $c, $data, $DIC, $GLOBALS, $ilDB, $name, ilSession\_destroy(), ilSession\_destroyByUserId(), ilSession\_destroyExpiredSessions(), ilSession\_duplicate(), ilSession\_exists(), ilSession\_getData(), and ilSession\SESSION_HANDLING_FIXED.

Referenced by setUp().

65  : void
66  {
67  global $DIC;
68 
69  $GLOBALS[$name] = $value;
70 
71  unset($DIC[$name]);
72  $DIC[$name] = static function ($c) use ($name) {
73  return $GLOBALS[$name];
74  };
75  }
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

ilSessionTest::setUp ( )
protected

Definition at line 32 of file ilSessionTest.php.

References $dic, $GLOBALS, and setGlobalVariable().

32  : void
33  {
34  $this->dic = new Container();
35  $GLOBALS['DIC'] = $this->dic;
36 
37  //$this->setGlobalVariable('lng', $this->getLanguageMock());
38  $this->setGlobalVariable(
39  'ilCtrl',
40  $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock()
41  );
42  $this->setGlobalVariable(
43  'ilUser',
44  $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock()
45  );
46  $this->setGlobalVariable(
47  'ilDB',
48  $this->getMockBuilder(ilDBInterface::class)->disableAutoReturnValueGeneration()->getMock()
49  );
50  $this->setGlobalVariable(
51  'ilClientIniFile',
52  $this->getMockBuilder(ilIniFile::class)->disableOriginalConstructor()->getMock()
53  );
54  $this->setGlobalVariable(
55  'ilSetting',
56  $this->getMockBuilder(\ILIAS\Administration\Setting::class)->getMock()
57  );
58  parent::setUp();
59  }
setGlobalVariable(string $name, $value)
Class ChatMainBarProvider .
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$dic
Definition: result.php:32
+ Here is the call graph for this function:

◆ testPasswordAssisstanceSession()

ilSessionTest::testPasswordAssisstanceSession ( )

Definition at line 211 of file ilSessionTest.php.

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

211  : void
212  {
213  global $DIC;
214 
215  $ilUser = $DIC['ilUser'];
216 
217  $result = "";
218  $this->markTestIncomplete(
219  'This test has not been implemented yet.'
220  );
221  return;
222  // write session
223  db_pwassist_session_write("12345", 60, $ilUser->getId());
224 
225  // find
227  if ($res["pwassist_id"] === "12345") {
228  $result .= "find-";
229  }
230 
231  // read
232  $res = db_pwassist_session_read("12345");
233  if ((int) $res["user_id"] === $ilUser->getId()) {
234  $result .= "read-";
235  }
236 
237  // destroy
239  $res = db_pwassist_session_read("12345");
240  if (!$res) {
241  $result .= "destroy-";
242  }
243 
245 
246  $this->assertEquals("find-read-destroy-", $result);// TODO PHP8-REVIEW This method does not exists (because this class has no parent class)
247  }
$res
Definition: ltiservices.php:69
db_pwassist_session_destroy($pwassist_id)
destroy session
db_pwassist_session_read($pwassist_id)
global $DIC
Definition: feed.php:28
db_pwassist_session_find($user_id)
db_pwassist_session_gc()
removes all expired sessions
$ilUser
Definition: imgupload.php:34
db_pwassist_session_write($pwassist_id, $maxlifetime, $user_id)
Writes serialized session data to the database.
+ Here is the call graph for this function:

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