public function testGetListenerPriority()
 {
     $listener1 = new TestEventListener();
     $listener2 = new TestEventListener();
     $this->dispatcher->addListener('pre.foo', $listener1, -10);
     $this->dispatcher->addListener('pre.foo', $listener2);
     $this->assertSame(-10, $this->dispatcher->getListenerPriority('pre.foo', $listener1));
     $this->assertSame(0, $this->dispatcher->getListenerPriority('pre.foo', $listener2));
     $this->assertNull($this->dispatcher->getListenerPriority('pre.bar', $listener2));
     $this->assertNull($this->dispatcher->getListenerPriority('pre.foo', function () {
     }));
 }
 /**
  * @test
  * We are not checking Laravel's listeners as its interface does not contain a getListenerPriority function
  */
 public function it_asks_the_symfony_dispatcher_for_a_listeners_priority()
 {
     $this->symfony->getListenerPriority(static::EVENT, 'listener')->willReturn(100);
     $this->assertEquals(100, $this->dispatcher->getListenerPriority(static::EVENT, 'listener'));
 }
Example #3
0
 public function getListenerPriority($eventName, $listener)
 {
     $this->lazyLoad($eventName);
     return parent::getListenerPriority($eventName, $listener);
 }