You are here

public function EventManagerTest::testAddEventListener in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/doctrine/common/tests/Doctrine/Tests/Common/EventManagerTest.php \Doctrine\Tests\Common\EventManagerTest::testAddEventListener()

File

vendor/doctrine/common/tests/Doctrine/Tests/Common/EventManagerTest.php, line 35

Class

EventManagerTest

Namespace

Doctrine\Tests\Common

Code

public function testAddEventListener() {
  $this->_eventManager
    ->addEventListener(array(
    'preFoo',
    'postFoo',
  ), $this);
  $this
    ->assertTrue($this->_eventManager
    ->hasListeners(self::preFoo));
  $this
    ->assertTrue($this->_eventManager
    ->hasListeners(self::postFoo));
  $this
    ->assertEquals(1, count($this->_eventManager
    ->getListeners(self::preFoo)));
  $this
    ->assertEquals(1, count($this->_eventManager
    ->getListeners(self::postFoo)));
  $this
    ->assertEquals(2, count($this->_eventManager
    ->getListeners()));
}