ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

100 {
101 $logger = $this->createMock(ilLogger::class);
102
103 return new ilAppEventHandler($logger);
104 }
Global event handler.

Referenced by testEvent().

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

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 }
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 setUp().

+ Here is the caller graph for this function:

◆ setUp()

EventTest::setUp ( )
protected

Definition at line 35 of file EventTest.php.

35 : void
36 {
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 }
setGlobalVariable(string $name, $value)
Definition: EventTest.php:83
$dic
Definition: ltiresult.php:33

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

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

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 }
getHandler()
Definition: EventTest.php:99
$handler
Definition: oai.php:29

References $handler, and getHandler().

+ Here is the call graph for this function:

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