ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\Event\ContinueCallbackTest Class Reference
+ Inheritance diagram for Sabre\Event\ContinueCallbackTest:
+ Collaboration diagram for Sabre\Event\ContinueCallbackTest:

Public Member Functions

 testContinueCallBack ()
 
 testContinueCallBackBreak ()
 
 testContinueCallBackBreakByHandler ()
 

Detailed Description

Definition at line 5 of file ContinueCallbackTest.php.

Member Function Documentation

◆ testContinueCallBack()

Sabre\Event\ContinueCallbackTest::testContinueCallBack ( )

Definition at line 7 of file ContinueCallbackTest.php.

References $r.

7  {
8 
9  $ee = new EventEmitter();
10 
11  $handlerCounter = 0;
12  $bla = function() use (&$handlerCounter) {
13  $handlerCounter++;
14  };
15  $ee->on('foo', $bla);
16  $ee->on('foo', $bla);
17  $ee->on('foo', $bla);
18 
19  $continueCounter = 0;
20  $r = $ee->emit('foo', [], function() use (&$continueCounter) {
21  $continueCounter++;
22  return true;
23  });
24  $this->assertTrue($r);
25  $this->assertEquals(3, $handlerCounter);
26  $this->assertEquals(2, $continueCounter);
27 
28  }
$r
Definition: example_031.php:79

◆ testContinueCallBackBreak()

Sabre\Event\ContinueCallbackTest::testContinueCallBackBreak ( )

Definition at line 30 of file ContinueCallbackTest.php.

References $r.

30  {
31 
32  $ee = new EventEmitter();
33 
34  $handlerCounter = 0;
35  $bla = function() use (&$handlerCounter) {
36  $handlerCounter++;
37  };
38  $ee->on('foo', $bla);
39  $ee->on('foo', $bla);
40  $ee->on('foo', $bla);
41 
42  $continueCounter = 0;
43  $r = $ee->emit('foo', [], function() use (&$continueCounter) {
44  $continueCounter++;
45  return false;
46  });
47  $this->assertTrue($r);
48  $this->assertEquals(1, $handlerCounter);
49  $this->assertEquals(1, $continueCounter);
50 
51  }
$r
Definition: example_031.php:79

◆ testContinueCallBackBreakByHandler()

Sabre\Event\ContinueCallbackTest::testContinueCallBackBreakByHandler ( )

Definition at line 53 of file ContinueCallbackTest.php.

References $r.

53  {
54 
55  $ee = new EventEmitter();
56 
57  $handlerCounter = 0;
58  $bla = function() use (&$handlerCounter) {
59  $handlerCounter++;
60  return false;
61  };
62  $ee->on('foo', $bla);
63  $ee->on('foo', $bla);
64  $ee->on('foo', $bla);
65 
66  $continueCounter = 0;
67  $r = $ee->emit('foo', [], function() use (&$continueCounter) {
68  $continueCounter++;
69  return false;
70  });
71  $this->assertFalse($r);
72  $this->assertEquals(1, $handlerCounter);
73  $this->assertEquals(0, $continueCounter);
74 
75  }
$r
Definition: example_031.php:79

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