本文整理汇总了PHP中Symfony\Component\EventDispatcher\EventDispatcher::getListenerPriority方法的典型用法代码示例。如果您正苦于以下问题:PHP EventDispatcher::getListenerPriority方法的具体用法?PHP EventDispatcher::getListenerPriority怎么用?PHP EventDispatcher::getListenerPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\EventDispatcher\EventDispatcher
的用法示例。
在下文中一共展示了EventDispatcher::getListenerPriority方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetListenerPriority
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 () {
}));
}
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:12,代码来源:AbstractEventDispatcherTest.php
示例2: it_asks_the_symfony_dispatcher_for_a_listeners_priority
/**
* @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'));
}
示例3: getListenerPriority
public function getListenerPriority($eventName, $listener)
{
$this->lazyLoad($eventName);
return parent::getListenerPriority($eventName, $listener);
}