ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 $helper = $this->getMockBuilder(ilTermsOfServiceHelper::class)->disableOriginalConstructor()->getMock();
55
56 $helper
57 ->expects($this->once())
58 ->method('deleteAcceptanceHistoryByUser')
59 ->with($this->isType('integer'));
60
62 ilTestableTermsOfServiceAppEventListener::handleEvent('Services/User', 'deleteUser', ['usr_id' => 6]);
63 }
static handleEvent($a_component, $a_event, $a_parameter)
Handle an event in a listener.
setGlobalVariable(string $name, $value)

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

+ Here is the call graph for this function:

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