5 require_once(
"libs/composer/vendor/autoload.php");
37 $this->mock =
new TriggererMock();
40 protected $signal_mock_counter = 0;
43 $this->signal_mock_counter++;
46 ->disableOriginalClone()
47 ->disableArgumentCloning()
48 ->disallowMockingUnknownTypes()
49 ->setMockClassName(
"Signal_{$this->signal_mock_counter}")
55 $this->assertEquals([], $this->mock->getTriggeredSignals());
60 $signal = $this->getSignalMock();
62 $mock = $this->mock->_appendTriggeredSignal($signal,
"some_event");
63 $this->assertNotSame($mock, $this->mock);
68 $signal1 = $this->getSignalMock();
69 $signal2 = $this->getSignalMock();
70 $signal3 = $this->getSignalMock();
72 $mock = $this->mock->_appendTriggeredSignal($signal1,
"some_event");
74 ->_appendTriggeredSignal($signal2,
"some_event")
75 ->_appendTriggeredSignal($signal3,
"some_event");
77 $this->assertEquals([], $this->mock->getTriggeredSignals());
78 $this->assertEquals([
new TriggeredSignal($signal1,
"some_event")], $mock->getTriggeredSignals());
84 $signal = $this->getSignalMock();
86 $mock = $this->mock->_withTriggeredSignal($signal,
"some_event");
88 $this->assertNotSame($mock, $this->mock);
93 $signal1 = $this->getSignalMock();
94 $signal2 = $this->getSignalMock();
96 $mock = $this->mock->_withTriggeredSignal($signal1,
"some_event");
97 $mock2 = $mock->_withTriggeredSignal($signal2,
"some_event");
99 $this->assertEquals([
new TriggeredSignal($signal1,
"some_event")], $mock->getTriggeredSignals());
100 $this->assertEquals([
new TriggeredSignal($signal2,
"some_event")], $mock2->getTriggeredSignals());
105 $signal1 = $this->getSignalMock();
106 $signal2 = $this->getSignalMock();
108 $this->mock->_setTriggeredSignal($signal1,
"some_event");
109 $this->mock->_setTriggeredSignal($signal2,
"some_event");
111 $this->assertEquals([
new TriggeredSignal($signal2,
"some_event")], $this->mock->getTriggeredSignals());
116 $signal = $this->getSignalMock();
118 $mock = $this->mock->withResetTriggeredSignals();
120 $this->assertNotSame($mock, $this->mock);
125 $signal1 = $this->getSignalMock();
126 $signal2 = $this->getSignalMock();
129 ->_appendTriggeredSignal($signal1,
"some_event")
130 ->_appendTriggeredSignal($signal2,
"some_event")
131 ->withResetTriggeredSignals();
133 $this->assertEquals([], $mock->getTriggeredSignals());
138 $signals = $this->mock->getTriggeredSignalsFor(
"some_event");
139 $this->assertEquals([], $signals);
144 $signal1 = $this->getSignalMock();
145 $signal2 = $this->getSignalMock();
148 ->_appendTriggeredSignal($signal1,
"some_event")
149 ->_appendTriggeredSignal($signal2,
"some_event");
151 $signals = $mock->getTriggeredSignalsFor(
"some_event");
153 $this->assertEquals([$signal1, $signal2], $signals);
testWithResetTriggeredSignal()
_setTriggeredSignal(Component\Signal $signal, $event)
testWithTriggeredSignal()
testAppendTriggeredSignal()
setTriggeredSignal(Component\Signal $signal, $event)
Add a triggered signal, replacing any othe signals registered on the same event.
testWithResetTriggeredSignalIsImmutable()
appendTriggeredSignal(Component\Signal $signal, $event)
Append a triggered signal to other signals of the same event.
testWithTriggeredSignalIsImmutable()
testAppendTriggeredSignalIsImmutable()
_withTriggeredSignal(Component\Signal $signal, $event)
_appendTriggeredSignal(Component\Signal $signal, $event)
testGetTriggeredSignalsForNonRegisteredSignal()
testGetTriggeredSignals()
withTriggeredSignal(Component\Signal $signal, $event)
Add a triggered signal, replacing any other signals registered on the same event. ...