ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 
 setGlobalVariable (string $name, $value)
 
 assertException (string $exceptionClass)
 
 getCriterionConfig ($value=null)
 
- Protected Attributes inherited from ilTermsOfServiceBaseTest
 $dic
 

Detailed Description

Member Function Documentation

◆ testAcceptanceHistoryDeletionIsDelegatedWhenUserIsDeleted()

ilTermsOfServiceAppEventListenerTest::testAcceptanceHistoryDeletionIsDelegatedWhenUserIsDeleted ( )

Definition at line 13 of file ilTermsOfServiceAppEventListenerTest.php.

References Sabre\Event\once().

14  {
15  $helper = $this->getMockBuilder(\ilTermsOfServiceHelper::class)->disableOriginalConstructor()->getMock();
16 
17  $helper
18  ->expects($this->once())
19  ->method('deleteAcceptanceHistoryByUser')
20  ->with($this->isType('integer'));
21 
22  $listener = new \ilTermsOfServiceAppEventListener($helper);
23  $listener
24  ->withComponent('Services/User')
25  ->withEvent('deleteUser')
26  ->withParameters(['usr_id' => 6])
27  ->handle();
28 
29  $listener
30  ->withComponent('Modules/Course')
31  ->withEvent('deleteUser')
32  ->withParameters(['usr_id' => 6])
33  ->handle();
34 
35  $listener
36  ->withComponent('Services/User')
37  ->withEvent('afterCreate')
38  ->withParameters(['usr_id' => 6])
39  ->handle();
40  }
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

◆ testStaticEventListeningWorksAsExpected()

ilTermsOfServiceAppEventListenerTest::testStaticEventListeningWorksAsExpected ( )

Definition at line 45 of file ilTermsOfServiceAppEventListenerTest.php.

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

46  {
47  $database = $this
48  ->getMockBuilder(\ilDBInterface::class)
49  ->getMock();
50 
51  $this->setGlobalVariable('ilDB', $database);
52 
53  $helper = $this->getMockBuilder(\ilTermsOfServiceHelper::class)->disableOriginalConstructor()->getMock();
54 
55  $helper
56  ->expects($this->once())
57  ->method('deleteAcceptanceHistoryByUser')
58  ->with($this->isType('integer'));
59 
60 
62  \ilTestableTermsOfServiceAppEventListener::handleEvent('Services/User', 'deleteUser', ['usr_id' => 6]);
63  }
setGlobalVariable(string $name, $value)
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
static handleEvent($a_component, $a_event, $a_parameter)
Handle an event in a listener.component, e.g. "Modules/Forum" or "Services/User" event e...
+ Here is the call graph for this function:

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