public function unparticipate() { if (!Authentication::getInstance()->isAuthenticated()) { throw new NotAuthenticatedException(); } $id = (int) $this->getParams()[0]; $event = $this->eventModel->get($id); if (empty($event)) { throw new EventNotFoundException($id); } $participate = $this->eventModel->getParticipateUser($id, Authentication::getInstance()->getUserId()); if (empty($participate)) { throw new NotParticipateEventException($id, Authentication::getInstance()->getUserId()); } $this->participateModel->deleteEventParticipation($id, Authentication::getInstance()->getUserId()); $this->getView()->redirect('/event/show/' . $id); }
public function testGetOne() { $this->model = new EventModel(); $state = $this->model->get(1); $this->assertNotEmpty($state); }