ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
EventTest Class Reference

Test clipboard repository. More...

+ Inheritance diagram for EventTest:
+ Collaboration diagram for EventTest:

Public Member Functions

 testEvent ()
 Test event. More...
 

Protected Member Functions

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

Detailed Description

Test clipboard repository.

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

Definition at line 31 of file EventTest.php.

Member Function Documentation

◆ getHandler()

EventTest::getHandler ( )
protected

Definition at line 99 of file EventTest.php.

Referenced by testEvent().

100  {
101  $logger = $this->createMock(ilLogger::class);
102 
103  return new ilAppEventHandler($logger);
104  }
Global event handler.
+ Here is the caller graph for this function:

◆ setGlobalVariable()

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

Definition at line 83 of file EventTest.php.

References $c, $DIC, and $GLOBALS.

Referenced by setUp().

83  : void
84  {
85  global $DIC;
86 
87  $GLOBALS[$name] = $value;
88 
89  unset($DIC[$name]);
90  $DIC[$name] = static function (Container $c) use ($value) {
91  return $value;
92  };
93  }
$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()

EventTest::setUp ( )
protected

Definition at line 35 of file EventTest.php.

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

35  : void
36  {
37  $dic = new ILIAS\DI\Container();
38  $GLOBALS['DIC'] = $dic;
39 
40  if (!defined("ILIAS_LOG_ENABLED")) {
41  define("ILIAS_LOG_ENABLED", false);
42  }
43 
44  parent::setUp();
45 
46  $db_mock = $this->createMock(ilDBInterface::class);
47  $db_mock->method("fetchAssoc")
48  ->will(
49  $this->onConsecutiveCalls(
50  [
51  "component" => "components/ILIAS/EventHandling",
52  "id" => "MyTestComponent"
53  ],
54  null
55  )
56  );
57 
58 
59  $this->setGlobalVariable(
60  "ilDB",
61  $db_mock
62  );
63  $this->setGlobalVariable(
64  "ilSetting",
65  $this->createMock(ilSetting::class)
66  );
67  $component_repository = $this->createMock(ilComponentRepository::class);
68  $this->setGlobalVariable(
69  "component.repository",
70  $component_repository
71  );
72  $component_factory = $this->createMock(ilComponentFactory::class);
73  $this->setGlobalVariable(
74  "component.factory",
75  $component_factory
76  );
77  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$GLOBALS["DIC"]
Definition: wac.php:53
setGlobalVariable(string $name, $value)
Definition: EventTest.php:83
$dic
Definition: result.php:31
+ Here is the call graph for this function:

◆ tearDown()

EventTest::tearDown ( )
protected

Definition at line 95 of file EventTest.php.

95  : void
96  {
97  }

◆ testEvent()

EventTest::testEvent ( )

Test event.

Definition at line 109 of file EventTest.php.

References $handler, and getHandler().

109  : void
110  {
111  $handler = $this->getHandler();
112 
113  $this->expectException(ilEventHandlingTestException::class);
114 
115  $handler->raise(
116  "components/ILIAS/EventHandling",
117  "myEvent",
118  [
119  "par1" => "val1",
120  "par2" => "val2"
121  ]
122  );
123  }
$handler
Definition: oai.php:30
getHandler()
Definition: EventTest.php:99
+ Here is the call graph for this function:

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