ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ILIAS_UI_Component_TriggererTest Class Reference
+ Inheritance diagram for ILIAS_UI_Component_TriggererTest:
+ Collaboration diagram for ILIAS_UI_Component_TriggererTest:

Public Member Functions

 setUp ()
 
 testStartEmpty ()
 
 testAppendTriggeredSignalIsImmutable ()
 
 testAppendTriggeredSignal ()
 
 testWithTriggeredSignalIsImmutable ()
 
 testWithTriggeredSignal ()
 
 testSetTriggeredSignal ()
 
 testWithResetTriggeredSignalIsImmutable ()
 
 testWithResetTriggeredSignal ()
 
 testGetTriggeredSignalsForNonRegisteredSignal ()
 
 testGetTriggeredSignals ()
 

Protected Member Functions

 getSignalMock ()
 

Protected Attributes

 $signal_mock_counter = 0
 

Detailed Description

Member Function Documentation

◆ getSignalMock()

ILIAS_UI_Component_TriggererTest::getSignalMock ( )
protected

Definition at line 41 of file TriggererTest.php.

42  {
43  $this->signal_mock_counter++;
44  return $this
45  ->getMockBuilder(Component\Signal::class)
46  ->disableOriginalClone()
47  ->disableArgumentCloning()
48  ->disallowMockingUnknownTypes()
49  ->setMockClassName("Signal_{$this->signal_mock_counter}")
50  ->getMock();
51  }

◆ setUp()

ILIAS_UI_Component_TriggererTest::setUp ( )

Definition at line 35 of file TriggererTest.php.

36  {
37  $this->mock = new TriggererMock();
38  }

◆ testAppendTriggeredSignal()

ILIAS_UI_Component_TriggererTest::testAppendTriggeredSignal ( )

Definition at line 66 of file TriggererTest.php.

67  {
68  $signal1 = $this->getSignalMock();
69  $signal2 = $this->getSignalMock();
70  $signal3 = $this->getSignalMock();
71 
72  $mock = $this->mock->_appendTriggeredSignal($signal1, "some_event");
73  $mock2 = $this->mock
74  ->_appendTriggeredSignal($signal2, "some_event")
75  ->_appendTriggeredSignal($signal3, "some_event");
76 
77  $this->assertEquals([], $this->mock->getTriggeredSignals());
78  $this->assertEquals([new TriggeredSignal($signal1, "some_event")], $mock->getTriggeredSignals());
79  $this->assertEquals([new TriggeredSignal($signal2, "some_event"), new TriggeredSignal($signal3, "some_event")], $mock2->getTriggeredSignals());
80  }

◆ testAppendTriggeredSignalIsImmutable()

ILIAS_UI_Component_TriggererTest::testAppendTriggeredSignalIsImmutable ( )

Definition at line 58 of file TriggererTest.php.

59  {
60  $signal = $this->getSignalMock();
61 
62  $mock = $this->mock->_appendTriggeredSignal($signal, "some_event");
63  $this->assertNotSame($mock, $this->mock);
64  }

◆ testGetTriggeredSignals()

ILIAS_UI_Component_TriggererTest::testGetTriggeredSignals ( )

Definition at line 142 of file TriggererTest.php.

143  {
144  $signal1 = $this->getSignalMock();
145  $signal2 = $this->getSignalMock();
146 
147  $mock = $this->mock
148  ->_appendTriggeredSignal($signal1, "some_event")
149  ->_appendTriggeredSignal($signal2, "some_event");
150 
151  $signals = $mock->getTriggeredSignalsFor("some_event");
152 
153  $this->assertEquals([$signal1, $signal2], $signals);
154  }

◆ testGetTriggeredSignalsForNonRegisteredSignal()

ILIAS_UI_Component_TriggererTest::testGetTriggeredSignalsForNonRegisteredSignal ( )

Definition at line 136 of file TriggererTest.php.

137  {
138  $signals = $this->mock->getTriggeredSignalsFor("some_event");
139  $this->assertEquals([], $signals);
140  }

◆ testSetTriggeredSignal()

ILIAS_UI_Component_TriggererTest::testSetTriggeredSignal ( )

Definition at line 103 of file TriggererTest.php.

104  {
105  $signal1 = $this->getSignalMock();
106  $signal2 = $this->getSignalMock();
107 
108  $this->mock->_setTriggeredSignal($signal1, "some_event");
109  $this->mock->_setTriggeredSignal($signal2, "some_event");
110 
111  $this->assertEquals([new TriggeredSignal($signal2, "some_event")], $this->mock->getTriggeredSignals());
112  }

◆ testStartEmpty()

ILIAS_UI_Component_TriggererTest::testStartEmpty ( )

Definition at line 53 of file TriggererTest.php.

54  {
55  $this->assertEquals([], $this->mock->getTriggeredSignals());
56  }

◆ testWithResetTriggeredSignal()

ILIAS_UI_Component_TriggererTest::testWithResetTriggeredSignal ( )

Definition at line 123 of file TriggererTest.php.

124  {
125  $signal1 = $this->getSignalMock();
126  $signal2 = $this->getSignalMock();
127 
128  $mock = $this->mock
129  ->_appendTriggeredSignal($signal1, "some_event")
130  ->_appendTriggeredSignal($signal2, "some_event")
131  ->withResetTriggeredSignals();
132 
133  $this->assertEquals([], $mock->getTriggeredSignals());
134  }

◆ testWithResetTriggeredSignalIsImmutable()

ILIAS_UI_Component_TriggererTest::testWithResetTriggeredSignalIsImmutable ( )

Definition at line 114 of file TriggererTest.php.

115  {
116  $signal = $this->getSignalMock();
117 
118  $mock = $this->mock->withResetTriggeredSignals();
119 
120  $this->assertNotSame($mock, $this->mock);
121  }

◆ testWithTriggeredSignal()

ILIAS_UI_Component_TriggererTest::testWithTriggeredSignal ( )

Definition at line 91 of file TriggererTest.php.

92  {
93  $signal1 = $this->getSignalMock();
94  $signal2 = $this->getSignalMock();
95 
96  $mock = $this->mock->_withTriggeredSignal($signal1, "some_event");
97  $mock2 = $mock->_withTriggeredSignal($signal2, "some_event");
98 
99  $this->assertEquals([new TriggeredSignal($signal1, "some_event")], $mock->getTriggeredSignals());
100  $this->assertEquals([new TriggeredSignal($signal2, "some_event")], $mock2->getTriggeredSignals());
101  }

◆ testWithTriggeredSignalIsImmutable()

ILIAS_UI_Component_TriggererTest::testWithTriggeredSignalIsImmutable ( )

Definition at line 82 of file TriggererTest.php.

83  {
84  $signal = $this->getSignalMock();
85 
86  $mock = $this->mock->_withTriggeredSignal($signal, "some_event");
87 
88  $this->assertNotSame($mock, $this->mock);
89  }

Field Documentation

◆ $signal_mock_counter

ILIAS_UI_Component_TriggererTest::$signal_mock_counter = 0
protected

Definition at line 40 of file TriggererTest.php.


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