ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

References setGlobalVariable().

Referenced by testRemoveForUser().

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

References $c, $DIC, and $GLOBALS.

Referenced by initDBMock().

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  }
$c
Definition: deliver.php:25
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ setUp()

NotificationTest::setUp ( )
protected

Definition at line 40 of file NotificationTest.php.

References $dic, and $GLOBALS.

40  : void
41  {
42  parent::setUp();
43  $dic = new ILIAS\DI\Container();
44  $GLOBALS['DIC'] = $dic;
45  }
$GLOBALS["DIC"]
Definition: wac.php:53
$dic
Definition: result.php:31

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

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

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.
+ Here is the call graph for this function:

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