ILIAS  release_8 Revision v8.24
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 13 of file EventTest.php.

Member Function Documentation

◆ getHandler()

EventTest::getHandler ( )
protected

Definition at line 81 of file EventTest.php.

82 {
83 return new ilAppEventHandler();
84 }
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 65 of file EventTest.php.

65 : void
66 {
67 global $DIC;
68
69 $GLOBALS[$name] = $value;
70
71 unset($DIC[$name]);
72 $DIC[$name] = static function (Container $c) use ($value) {
73 return $value;
74 };
75 }
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 setUp().

+ Here is the caller graph for this function:

◆ setUp()

EventTest::setUp ( )
protected

Definition at line 17 of file EventTest.php.

17 : void
18 {
20 $GLOBALS['DIC'] = $dic;
21
22 if (!defined("ILIAS_LOG_ENABLED")) {
23 define("ILIAS_LOG_ENABLED", false);
24 }
25
26 parent::setUp();
27
28 $db_mock = $this->createMock(ilDBInterface::class);
29 $db_mock->method("fetchAssoc")
30 ->will(
31 $this->onConsecutiveCalls(
32 [
33 "component" => "Services/EventHandling",
34 "id" => "MyTestComponent"
35 ],
36 null
37 )
38 );
39
40
41 $this->setGlobalVariable(
42 "ilDB",
43 $db_mock
44 );
45 $this->setGlobalVariable(
46 "ilSetting",
47 $this->createMock(ilSetting::class)
48 );
49 $component_repository = $this->createMock(ilComponentRepository::class);
50 $this->setGlobalVariable(
51 "component.repository",
52 $component_repository
53 );
54 $component_factory = $this->createMock(ilComponentFactory::class);
55 $this->setGlobalVariable(
56 "component.factory",
57 $component_factory
58 );
59 }
setGlobalVariable(string $name, $value)
Definition: EventTest.php:65
$dic
Definition: result.php:32

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

+ Here is the call graph for this function:

◆ tearDown()

EventTest::tearDown ( )
protected

Definition at line 77 of file EventTest.php.

77 : void
78 {
79 }

◆ testEvent()

EventTest::testEvent ( )

Test event.

Definition at line 89 of file EventTest.php.

89 : void
90 {
91 $handler = $this->getHandler();
92
93 $this->expectException(ilEventHandlingTestException::class);
94
95 $handler->raise(
96 "MyTestComponent",
97 "MyEvent",
98 [
99 "par1" => "val1",
100 "par2" => "val2"
101 ]
102 );
103 }
getHandler()
Definition: EventTest.php:81

References getHandler().

+ Here is the call graph for this function:

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