public function testdetachWithPriorities() { $eventSubscriber = new TestEventSubscriberWithPriorities(); $this->emitter->attach($eventSubscriber); $this->assertNotEmpty($this->emitter->listeners(self::preFoo)); $this->assertNotEmpty($this->emitter->listeners(self::postFoo)); $this->emitter->detach($eventSubscriber); $this->assertEmpty($this->emitter->listeners(self::preFoo)); $this->assertEmpty($this->emitter->listeners(self::postFoo)); }
public static function prepareConfig($config, $logger) { $emitter = new Emitter(); if ($logger) { if ($logger instanceof \Psr\Log\LoggerInterface) { $emitter->attach(new LogSubscriber($logger, Formatter::DEBUG)); } else { throw new \Exception('Logger must implement PsrLogLoggerInterface'); } } $config['emitter'] = $emitter; return $config; }