Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 7a779792577d |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
108 { | 108 { |
109 $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); | 109 $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); |
110 $tdispatcher->addListener('foo', function () {}, 5); | 110 $tdispatcher->addListener('foo', function () {}, 5); |
111 | 111 |
112 $listeners = $tdispatcher->getNotCalledListeners(); | 112 $listeners = $tdispatcher->getNotCalledListeners(); |
113 $this->assertArrayHasKey('data', $listeners['foo.closure']); | 113 $this->assertArrayHasKey('stub', $listeners['foo.closure']); |
114 unset($listeners['foo.closure']['data']); | 114 unset($listeners['foo.closure']['stub']); |
115 $this->assertEquals(array(), $tdispatcher->getCalledListeners()); | 115 $this->assertEquals(array(), $tdispatcher->getCalledListeners()); |
116 $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); | 116 $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); |
117 | 117 |
118 $tdispatcher->dispatch('foo'); | 118 $tdispatcher->dispatch('foo'); |
119 | 119 |
120 $listeners = $tdispatcher->getCalledListeners(); | 120 $listeners = $tdispatcher->getCalledListeners(); |
121 unset($listeners['foo.closure']['data']); | 121 $this->assertArrayHasKey('stub', $listeners['foo.closure']); |
122 unset($listeners['foo.closure']['stub']); | |
122 $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); | 123 $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); |
123 $this->assertEquals(array(), $tdispatcher->getNotCalledListeners()); | 124 $this->assertEquals(array(), $tdispatcher->getNotCalledListeners()); |
125 } | |
126 | |
127 public function testClearCalledListeners() | |
128 { | |
129 $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); | |
130 $tdispatcher->addListener('foo', function () {}, 5); | |
131 | |
132 $tdispatcher->dispatch('foo'); | |
133 $tdispatcher->reset(); | |
134 | |
135 $listeners = $tdispatcher->getNotCalledListeners(); | |
136 $this->assertArrayHasKey('stub', $listeners['foo.closure']); | |
137 unset($listeners['foo.closure']['stub']); | |
138 $this->assertEquals(array(), $tdispatcher->getCalledListeners()); | |
139 $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); | |
124 } | 140 } |
125 | 141 |
126 public function testGetCalledListenersNested() | 142 public function testGetCalledListenersNested() |
127 { | 143 { |
128 $tdispatcher = null; | 144 $tdispatcher = null; |