ILIAS  release_8 Revision v8.23
NotificationTest Class Reference

Test clipboard repository. More...

+ Inheritance diagram for NotificationTest:
+ Collaboration diagram for NotificationTest:

Public Member Functions

 testRemoveForUser ()
 

Protected Member Functions

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

Detailed Description

Test clipboard repository.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 10 of file NotificationTest.php.

Member Function Documentation

◆ initDBMock()

NotificationTest::initDBMock ( )
protected

Definition at line 35 of file NotificationTest.php.

References setGlobalVariable().

Referenced by testRemoveForUser().

35  : \PHPUnit\Framework\MockObject\MockObject
36  {
37  $db_mock = $this->createMock(ilDBInterface::class);
38  $this->setGlobalVariable(
39  "ilDB",
40  $db_mock
41  );
42  return $db_mock;
43  }
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGlobalVariable()

NotificationTest::setGlobalVariable ( string  $name,
  $value 
)
protected

Definition at line 12 of file NotificationTest.php.

References $c, $DIC, $GLOBALS, and $name.

Referenced by initDBMock().

12  : void
13  {
14  global $DIC;
15 
16  $GLOBALS[$name] = $value;
17 
18  unset($DIC[$name]);
19  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
20  return $value;
21  };
22  }
$c
Definition: cli.php:38
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
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 caller graph for this function:

◆ setUp()

NotificationTest::setUp ( )
protected

Definition at line 24 of file NotificationTest.php.

References $dic, and $GLOBALS.

24  : void
25  {
26  parent::setUp();
27  $dic = new ILIAS\DI\Container();
28  $GLOBALS['DIC'] = $dic;
29  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$dic
Definition: result.php:32

◆ tearDown()

NotificationTest::tearDown ( )
protected

Definition at line 31 of file NotificationTest.php.

31  : void
32  {
33  }

◆ testRemoveForUser()

NotificationTest::testRemoveForUser ( )

Definition at line 45 of file NotificationTest.php.

References initDBMock(), and ilNotification\removeForUser().

45  : void
46  {
47  $db_mock = $this->initDBMock();
48  $db_mock->expects($this->once())
49  ->method('query')
50  ->with($this->stringContains('DELETE FROM notification WHERE user_id ='));
51 
53  }
static removeForUser(int $user_id)
Remove all notifications for given user.
+ Here is the call graph for this function:

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