You are here

public function EventManagerTest::testAddEventListener in Plug 7

File

lib/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()));
}