Skip to content

Commit 12b492b

Browse files
committed
add test that a single flush fires all queued events with same name
1 parent b7c152e commit 12b492b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/Events/EventsDispatcherTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,20 @@ public function testQueuedEventsCanBeForgotten()
156156
$this->assertSame('unset', $_SERVER['__event.test']);
157157
}
158158

159+
public function testMultiplePushedEventsWillGetFlushed()
160+
{
161+
$_SERVER['__event.test'] = '';
162+
$d = new Dispatcher;
163+
$d->push('update', ['name' => 'taylor ']);
164+
$d->push('update', ['name' => 'otwell']);
165+
$d->listen('update', function ($name) {
166+
$_SERVER['__event.test'] .= $name;
167+
});
168+
169+
$d->flush('update');
170+
$this->assertSame('taylor otwell', $_SERVER['__event.test']);
171+
}
172+
159173
public function testWildcardListeners()
160174
{
161175
unset($_SERVER['__event.test']);

0 commit comments

Comments
 (0)