Phergie_Event_Handler::clearEvents PHP Method

clearEvents() public method

Clears the event queue.
public clearEvents ( ) : Phergie_Event_Handler
return Phergie_Event_Handler Provides a fluent interface
    public function clearEvents()
    {
        $this->events = array();
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Overrides the runTest method to add additional annotations
  * @return PHPUnit_Framework_TestResult
  */
 protected function runTest()
 {
     if (null === $this->plugin) {
         throw new RuntimeException('Tests cannot be run before plugin is set');
     }
     // Clean the event handler... important!
     $this->handler->clearEvents();
     $info = $this->getAnnotations();
     $event = null;
     $eventArgs = array();
     if (isset($info['method']['event']) && isset($info['method']['event'][0])) {
         if (!is_string($info['method']['event'][0])) {
             throw new InvalidArgumentException('Only one event may be specified');
         }
         $event = $info['method']['event'][0];
         if (stristr($event, '::')) {
             $event = explode('::', $event);
         }
     }
     if (isset($info['method']['eventArg'])) {
         $eventArgs = $info['method']['eventArg'];
     }
     if (null !== $event) {
         $this->setEvent($event, $eventArgs);
     }
     $testResult = parent::runTest();
     // Clean the event handler again... just incase this time.
     $this->handler->clearEvents();
     return $testResult;
 }
All Usage Examples Of Phergie_Event_Handler::clearEvents