예제 #1
0
 /**
  * @covers Phossa\Event\EventDispatcher::isTriggered
  */
 public function testIsTriggered()
 {
     $this->object->on('start', function ($evt) {
         echo "START";
         return 'X';
     });
     $this->assertFalse($this->object->isTriggered('start'));
     $this->object->trigger('start');
     $this->assertTrue($this->object->isTriggered('start'));
 }
예제 #2
0
 /**
  * @see EventDispatcher::on()
  * @param string $pattern Either a regexp, a callback, an object, an event name or an array
  * @param function $callback Needed if $pattern is a regexp or an event name
  * @param integer $priority Listener's priority, higher is more important
  * @param boolean $important Whether this listener is more important than other ones of the same priority
  * @return EventDispatcher
  */
 public function on($pattern, $callback = null, $priority = 0, $important = false)
 {
     $this->eventDispatcher->on($pattern, $callback, $priority, $important);
     return $this;
 }