[Event Dispatcher] fixed 29703: TraceableEventDispatcher reset now sets callStack to null with test to dispatch after reset.

This commit is contained in:
mlievertz 2018-12-28 07:55:37 -05:00
parent 7448d850f9
commit 51bcdb8dc3
2 changed files with 13 additions and 1 deletions

View File

@ -221,7 +221,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
public function reset()
{
$this->callStack = array();
$this->callStack = null;
}
/**

View File

@ -139,6 +139,18 @@ class TraceableEventDispatcherTest extends TestCase
$this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
}
public function testDispatchAfterReset()
{
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$tdispatcher->addListener('foo', function () {}, 5);
$tdispatcher->reset();
$tdispatcher->dispatch('foo');
$listeners = $tdispatcher->getCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
}
public function testGetCalledListenersNested()
{
$tdispatcher = null;