@@ -26,7 +26,7 @@ public function testBasicEventExecution()
26
26
$ d ->listen ('foo ' , function ($ foo ) {
27
27
$ _SERVER ['__event.test ' ] = $ foo ;
28
28
});
29
- $ d ->fire ('foo ' , ['bar ' ]);
29
+ $ d ->dispatch ('foo ' , ['bar ' ]);
30
30
$ this ->assertEquals ('bar ' , $ _SERVER ['__event.test ' ]);
31
31
}
32
32
@@ -51,7 +51,7 @@ public function testContainerResolutionOfEventHandlers()
51
51
$ container ->shouldReceive ('make ' )->once ()->with ('FooHandler ' )->andReturn ($ handler = m::mock (stdClass::class));
52
52
$ handler ->shouldReceive ('onFooEvent ' )->once ()->with ('foo ' , 'bar ' );
53
53
$ d ->listen ('foo ' , 'FooHandler@onFooEvent ' );
54
- $ d ->fire ('foo ' , ['foo ' , 'bar ' ]);
54
+ $ d ->dispatch ('foo ' , ['foo ' , 'bar ' ]);
55
55
}
56
56
57
57
public function testContainerResolutionOfEventHandlersWithDefaultMethods ()
@@ -60,7 +60,7 @@ public function testContainerResolutionOfEventHandlersWithDefaultMethods()
60
60
$ container ->shouldReceive ('make ' )->once ()->with ('FooHandler ' )->andReturn ($ handler = m::mock (stdClass::class));
61
61
$ handler ->shouldReceive ('handle ' )->once ()->with ('foo ' , 'bar ' );
62
62
$ d ->listen ('foo ' , 'FooHandler ' );
63
- $ d ->fire ('foo ' , ['foo ' , 'bar ' ]);
63
+ $ d ->dispatch ('foo ' , ['foo ' , 'bar ' ]);
64
64
}
65
65
66
66
public function testQueuedEventsAreFired ()
@@ -104,7 +104,7 @@ public function testWildcardListeners()
104
104
$ d ->listen ('bar.* ' , function () {
105
105
$ _SERVER ['__event.test ' ] = 'nope ' ;
106
106
});
107
- $ d ->fire ('foo.bar ' );
107
+ $ d ->dispatch ('foo.bar ' );
108
108
109
109
$ this ->assertEquals ('wildcard ' , $ _SERVER ['__event.test ' ]);
110
110
}
@@ -116,13 +116,13 @@ public function testWildcardListenersCacheFlushing()
116
116
$ d ->listen ('foo.* ' , function () {
117
117
$ _SERVER ['__event.test ' ] = 'cached_wildcard ' ;
118
118
});
119
- $ d ->fire ('foo.bar ' );
119
+ $ d ->dispatch ('foo.bar ' );
120
120
$ this ->assertEquals ('cached_wildcard ' , $ _SERVER ['__event.test ' ]);
121
121
122
122
$ d ->listen ('foo.* ' , function () {
123
123
$ _SERVER ['__event.test ' ] = 'new_wildcard ' ;
124
124
});
125
- $ d ->fire ('foo.bar ' );
125
+ $ d ->dispatch ('foo.bar ' );
126
126
$ this ->assertEquals ('new_wildcard ' , $ _SERVER ['__event.test ' ]);
127
127
}
128
128
@@ -134,7 +134,7 @@ public function testListenersCanBeRemoved()
134
134
$ _SERVER ['__event.test ' ] = 'foo ' ;
135
135
});
136
136
$ d ->forget ('foo ' );
137
- $ d ->fire ('foo ' );
137
+ $ d ->dispatch ('foo ' );
138
138
139
139
$ this ->assertFalse (isset ($ _SERVER ['__event.test ' ]));
140
140
}
@@ -147,7 +147,7 @@ public function testWildcardListenersCanBeRemoved()
147
147
$ _SERVER ['__event.test ' ] = 'foo ' ;
148
148
});
149
149
$ d ->forget ('foo.* ' );
150
- $ d ->fire ('foo.bar ' );
150
+ $ d ->dispatch ('foo.bar ' );
151
151
152
152
$ this ->assertFalse (isset ($ _SERVER ['__event.test ' ]));
153
153
}
@@ -181,14 +181,14 @@ public function testEventPassedFirstToWildcards()
181
181
$ this ->assertEquals ('foo.bar ' , $ event );
182
182
$ this ->assertEquals (['first ' , 'second ' ], $ data );
183
183
});
184
- $ d ->fire ('foo.bar ' , ['first ' , 'second ' ]);
184
+ $ d ->dispatch ('foo.bar ' , ['first ' , 'second ' ]);
185
185
186
186
$ d = new Dispatcher ;
187
187
$ d ->listen ('foo.bar ' , function ($ first , $ second ) {
188
188
$ this ->assertEquals ('first ' , $ first );
189
189
$ this ->assertEquals ('second ' , $ second );
190
190
});
191
- $ d ->fire ('foo.bar ' , ['first ' , 'second ' ]);
191
+ $ d ->dispatch ('foo.bar ' , ['first ' , 'second ' ]);
192
192
}
193
193
194
194
public function testQueuedEventHandlersAreQueued ()
@@ -205,7 +205,7 @@ public function testQueuedEventHandlersAreQueued()
205
205
});
206
206
207
207
$ d ->listen ('some.event ' , TestDispatcherQueuedHandler::class.'@someMethod ' );
208
- $ d ->fire ('some.event ' , ['foo ' , 'bar ' ]);
208
+ $ d ->dispatch ('some.event ' , ['foo ' , 'bar ' ]);
209
209
}
210
210
211
211
public function testClassesWork ()
@@ -215,7 +215,7 @@ public function testClassesWork()
215
215
$ d ->listen (ExampleEvent::class, function () {
216
216
$ _SERVER ['__event.test ' ] = 'baz ' ;
217
217
});
218
- $ d ->fire (new ExampleEvent );
218
+ $ d ->dispatch (new ExampleEvent );
219
219
220
220
$ this ->assertSame ('baz ' , $ _SERVER ['__event.test ' ]);
221
221
}
@@ -227,7 +227,7 @@ public function testInterfacesWork()
227
227
$ d ->listen (SomeEventInterface::class, function () {
228
228
$ _SERVER ['__event.test ' ] = 'bar ' ;
229
229
});
230
- $ d ->fire (new AnotherEvent );
230
+ $ d ->dispatch (new AnotherEvent );
231
231
232
232
$ this ->assertSame ('bar ' , $ _SERVER ['__event.test ' ]);
233
233
}
@@ -242,7 +242,7 @@ public function testBothClassesAndInterfacesWork()
242
242
$ d ->listen (SomeEventInterface::class, function () {
243
243
$ _SERVER ['__event.test2 ' ] = 'baar ' ;
244
244
});
245
- $ d ->fire (new AnotherEvent );
245
+ $ d ->dispatch (new AnotherEvent );
246
246
247
247
$ this ->assertSame ('fooo ' , $ _SERVER ['__event.test1 ' ]);
248
248
$ this ->assertSame ('baar ' , $ _SERVER ['__event.test2 ' ]);
0 commit comments