[Event Dispatcher] fixed 29703: TraceableEventDispatcher reset now sets callStack to null with test to dispatch after reset.
This commit is contained in:
parent
7448d850f9
commit
51bcdb8dc3
@ -221,7 +221,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->callStack = array();
|
||||
$this->callStack = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user