/** * When this pod recieves an event, process it accordingly. * In this case, the pod simply calls the various functions in model before and after each event. * @param Event $eventObject The event object. */ public function onEvent(Event $eventObject) { if ($eventObject->getObject() === $this) { switch ($eventObject->getEvent()) { case 'after_dispense': $this->getModel()->afterDispense(); break; case 'after_open': $this->getModel()->afterOpen(); break; case 'before_store': $this->getModel()->beforeStore(); break; case 'after_store': $this->getModel()->afterStore(); break; case 'before_delete': $this->getModel()->beforeDelete(); break; case 'after_delete': $this->getModel()->afterDelete(); break; } } }
/** * @covers Paradox\Event::getEvent */ public function testGetEvent() { $this->assertEquals("testEvent", $this->event->getEvent(), 'The event type should be "testevent"'); }