Skip to content

Commit

Permalink
[Event Dispatcher] fixed 29703: TraceableEventDispatcher reset now se…
Browse files Browse the repository at this point in the history
…ts callStack to null with test to dispatch after reset.
  • Loading branch information
mlievertz committed Dec 28, 2018
1 parent 7448d85 commit 51bcdb8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Expand Up @@ -221,7 +221,7 @@ public function getNotCalledListeners()

public function reset()
{
$this->callStack = array();
$this->callStack = null;
}

/**
Expand Down
Expand Up @@ -139,6 +139,18 @@ public function testClearCalledListeners()
$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;
Expand Down

0 comments on commit 51bcdb8

Please sign in to comment.