Returns whether an event of the given type exists in the queue.
public hasEventOfType ( string $type ) : boolean | ||
$type | string | Event type from Phergie_Event_Request::TYPE_* constants |
return | boolean | TRUE if an event of the specified type exists in the queue, FALSE otherwise |
/** * Sends resulting outgoing events from earlier processing in handleEvents(). * * @param Phergie_Connection $connection Active connection * * @return void */ protected function processEvents(Phergie_Connection $connection) { $this->plugins->preDispatch(); if (count($this->events)) { foreach ($this->events as $event) { $this->ui->onCommand($event, $connection); $method = 'do' . ucfirst(strtolower($event->getType())); call_user_func_array(array($this->driver, $method), $event->getArguments()); } } $this->plugins->postDispatch(); if ($this->events->hasEventOfType(Phergie_Event_Request::TYPE_QUIT)) { $this->ui->onQuit($connection); $this->connections->removeConnection($connection); } $this->events->clearEvents(); }
/** * Assert that a given event type DOES NOT exist in the event handler * @param string $event * @param string $message */ public function assertDoesNotHaveEvent($event, $message = null) { self::assertFalse($this->handler->hasEventOfType($event), $message); }
/** * Tests that the handler can accurately identify whether it has an * event of a specified type. * * @return void * @depends testAddEventWithValidData */ public function testHasEventOfType() { $this->assertFalse($this->events->hasEventOfType($this->type)); $this->addMockEvent(); $this->assertTrue($this->events->hasEventOfType($this->type)); }