ILIAS  release_8 Revision v8.24
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.

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)

References setGlobalVariable().

Referenced by testRemoveForUser().

+ 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.

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 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247

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

Referenced by initDBMock().

+ Here is the caller graph for this function:

◆ setUp()

NotificationTest::setUp ( )
protected

Definition at line 24 of file NotificationTest.php.

24 : void
25 {
26 parent::setUp();
28 $GLOBALS['DIC'] = $dic;
29 }
$dic
Definition: result.php:32

References $dic, and $GLOBALS.

◆ 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.

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.

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

+ Here is the call graph for this function:

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