/** * 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::getObject */ public function testGetObject() { $object = $this->event->getObject(); $this->assertInstanceOf('\\stdClass', $object, "The object should be an instance of stdClass"); $this->assertEquals("testObject", $object->name, 'The object\'s name should be "testObject"'); }