ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTermsOfServiceAppEventListenerTest Class Reference

Class ilTermsOfServiceAppEventListenerTest. More...

+ Inheritance diagram for ilTermsOfServiceAppEventListenerTest:
+ Collaboration diagram for ilTermsOfServiceAppEventListenerTest:

Public Member Functions

 testAcceptanceHistoryDeletionIsDelegatedWhenUserIsDeleted ()
 
 testStaticEventListeningWorksAsExpected ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilTermsOfServiceBaseTest
 setUp ()
 
 getLanguageMock ()
 
 getUiFactoryMock ()
 
 setGlobalVariable (string $name, $value)
 
 getCriterionConfig ($value=null)
 
- Protected Attributes inherited from ilTermsOfServiceBaseTest
 $dic
 

Detailed Description

Member Function Documentation

◆ testAcceptanceHistoryDeletionIsDelegatedWhenUserIsDeleted()

ilTermsOfServiceAppEventListenerTest::testAcceptanceHistoryDeletionIsDelegatedWhenUserIsDeleted ( )
Exceptions
ilTermsOfServiceMissingDatabaseAdapterException
ReflectionException

Definition at line 14 of file ilTermsOfServiceAppEventListenerTest.php.

14 : void
15 {
16 $helper = $this->getMockBuilder(ilTermsOfServiceHelper::class)->disableOriginalConstructor()->getMock();
17
18 $helper
19 ->expects($this->once())
20 ->method('deleteAcceptanceHistoryByUser')
21 ->with($this->isType('integer'));
22
23 $listener = new ilTermsOfServiceAppEventListener($helper);
24 $listener
25 ->withComponent('Services/User')
26 ->withEvent('deleteUser')
27 ->withParameters(['usr_id' => 6])
28 ->handle();
29
30 $listener
31 ->withComponent('Modules/Course')
32 ->withEvent('deleteUser')
33 ->withParameters(['usr_id' => 6])
34 ->handle();
35
36 $listener
37 ->withComponent('Services/User')
38 ->withEvent('afterCreate')
39 ->withParameters(['usr_id' => 6])
40 ->handle();
41 }
Class ilTermsOfServiceAppEventListener.

◆ testStaticEventListeningWorksAsExpected()

ilTermsOfServiceAppEventListenerTest::testStaticEventListeningWorksAsExpected ( )
Exceptions
ReflectionException

Definition at line 46 of file ilTermsOfServiceAppEventListenerTest.php.

46 : void
47 {
48 $database = $this
49 ->getMockBuilder(ilDBInterface::class)
50 ->getMock();
51
52 $this->setGlobalVariable('ilDB', $database);
53
54 $evaluator = $this
55 ->getMockBuilder(ilTermsOfServiceDocumentEvaluation::class)
56 ->getMock();
57 $this->setGlobalVariable('tos.document.evaluator', $evaluator);
58
59 $criterionFactory = $this
60 ->getMockBuilder(ilTermsOfServiceCriterionTypeFactoryInterface::class)
61 ->getMock();
62 $this->setGlobalVariable('tos.criteria.type.factory', $criterionFactory);
63
64 $helper = $this->getMockBuilder(ilTermsOfServiceHelper::class)->disableOriginalConstructor()->getMock();
65
66 $helper
67 ->expects($this->once())
68 ->method('deleteAcceptanceHistoryByUser')
69 ->with($this->isType('integer'));
70
72 ilTestableTermsOfServiceAppEventListener::handleEvent('Services/User', 'deleteUser', ['usr_id' => 6]);
73 }
setGlobalVariable(string $name, $value)
static handleEvent($a_component, $a_event, $a_parameter)
Handle an event in a listener.

References ilTestableTermsOfServiceAppEventListener\$mockHelper, ilTestableTermsOfServiceAppEventListener\handleEvent(), and ilTermsOfServiceBaseTest\setGlobalVariable().

+ Here is the call graph for this function:

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