예제 #1
0
 /**
  * Get static collections container
  *
  * @return false|Zend_EventManager_SharedEventCollection
  */
 public function getSharedCollections()
 {
     if (null === $this->sharedCollections) {
         $this->setSharedCollections(Zend_EventManager_StaticEventManager::getInstance());
     }
     return $this->sharedCollections;
 }
예제 #2
0
 public function testTriggerMergesPrioritiesOfStaticAndInstanceListeners()
 {
     $this->test = (object) array('results' => array());
     Zend_EventManager_StaticEventManager::getInstance()->attach('Zend_EventManager_TestAsset_ClassWithEvents', 'foo', array($this, 'aggregateStatic'), 100);
     $class = new Zend_EventManager_TestAsset_ClassWithEvents();
     $class->events()->attach('foo', array($this, 'aggregateLocal'), -100);
     $class->foo();
     $this->assertEquals(array('static', 'local'), $this->test->results);
 }
예제 #3
0
 public function testListenersAttachedToAnyIdentifierProvidedToEventManagerWillBeTriggered()
 {
     $identifiers = array('foo', 'bar');
     $manager = new Zend_EventManager_EventManager($identifiers);
     $events = Zend_EventManager_StaticEventManager::getInstance();
     $this->test = new stdClass();
     $this->test->triggered = 0;
     $events->attach('foo', 'bar', array($this, 'advanceTriggered'));
     $events->attach('foo', 'bar', array($this, 'advanceTriggered'));
     $manager->trigger('bar', $this, array());
     $this->assertEquals(2, $this->test->triggered);
 }