TestEventSubscriberWithPriorities example

$eventSubscriber = new TestEventSubscriber();
        $this->dispatcher->addSubscriber($eventSubscriber);
        $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
        $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
    }

    public function testAddSubscriberWithPriorities()
    {
        $eventSubscriber = new TestEventSubscriber();
        $this->dispatcher->addSubscriber($eventSubscriber);

        $eventSubscriber = new TestEventSubscriberWithPriorities();
        $this->dispatcher->addSubscriber($eventSubscriber);

        $listeners = $this->dispatcher->getListeners('pre.foo');
        $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
        $this->assertCount(2, $listeners);
        $this->assertInstanceOf(TestEventSubscriberWithPriorities::class$listeners[0][0]);
    }

    public function testAddSubscriberWithMultipleListeners()
    {
        $eventSubscriber = new TestEventSubscriberWithMultipleListeners();
        
public function testAddSubscriber() {
    $eventSubscriber = new TestEventSubscriber();
    $this->dispatcher->addSubscriber($eventSubscriber);
    $this->assertTrue($this->dispatcher->hasListeners(self::PREFOO));
    $this->assertTrue($this->dispatcher->hasListeners(self::POSTFOO));
  }

  public function testAddSubscriberWithPriorities() {
    $eventSubscriber = new TestEventSubscriber();
    $this->dispatcher->addSubscriber($eventSubscriber);

    $eventSubscriber = new TestEventSubscriberWithPriorities();
    $this->dispatcher->addSubscriber($eventSubscriber);

    $listeners = $this->dispatcher->getListeners('pre.foo');
    $this->assertTrue($this->dispatcher->hasListeners(self::PREFOO));
    $this->assertCount(2, $listeners);
    $this->assertInstanceOf(TestEventSubscriberWithPriorities::class$listeners[0][0]);
  }

  public function testAddSubscriberWithMultipleListeners() {
    $eventSubscriber = new TestEventSubscriberWithMultipleListeners();
    $this->dispatcher->addSubscriber($eventSubscriber);

    
Home | Imprint | This part of the site doesn't use cookies.