ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 26 of file NotificationTest.php.

Member Function Documentation

◆ initDBMock()

NotificationTest::initDBMock ( )
protected

Definition at line 51 of file NotificationTest.php.

51 : \PHPUnit\Framework\MockObject\MockObject
52 {
53 $db_mock = $this->createMock(ilDBInterface::class);
54 $this->setGlobalVariable(
55 "ilDB",
56 $db_mock
57 );
58 return $db_mock;
59 }
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 28 of file NotificationTest.php.

28 : void
29 {
30 global $DIC;
31
32 $GLOBALS[$name] = $value;
33
34 unset($DIC[$name]);
35 $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
36 return $value;
37 };
38 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54

References $c, $DIC, and $GLOBALS.

Referenced by initDBMock().

+ Here is the caller graph for this function:

◆ setUp()

NotificationTest::setUp ( )
protected

Definition at line 40 of file NotificationTest.php.

40 : void
41 {
42 parent::setUp();
44 $GLOBALS['DIC'] = $dic;
45 }
$dic
Definition: ltiresult.php:33

References $dic, and $GLOBALS.

◆ tearDown()

NotificationTest::tearDown ( )
protected

Definition at line 47 of file NotificationTest.php.

47 : void
48 {
49 }

◆ testRemoveForUser()

NotificationTest::testRemoveForUser ( )

Definition at line 61 of file NotificationTest.php.

61 : void
62 {
63 $db_mock = $this->initDBMock();
64 $db_mock->expects($this->once())
65 ->method('query')
66 ->with($this->stringContains('DELETE FROM notification WHERE user_id ='));
67
69 }
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: