public function testOffRemovesAllListeners() { $function = function () { }; $this->emitter->on('foo', $function); $this->emitter->off('foo', $function); $this->assertFalse($this->emitter->hasEventListener('foo', $function)); }
public function testOffMulti() { $closure = function () { }; $closure1 = function () { }; $this->event->on(array('a', 'b'), $closure); $this->event->addListener(array('a', 'b'), $closure1); $this->assertEquals(array($closure, $closure1), $this->event->listeners('a')); $this->assertEquals(array($closure, $closure1), $this->event->listeners('b')); $this->event->off(array('a', 'b'), $closure); $this->assertEquals(array(1 => $closure1), $this->event->listeners('a')); $this->assertEquals(array(1 => $closure1), $this->event->listeners('b')); }