public function testAll() { $this->model = new ParticipateModel(); $state = $this->model->insertEventParticipation(1, 1); $this->assertEquals(true, $state); $state = $this->model->getEventParticipation(1); $this->assertNotEmpty($state); $state = $this->model->deleteEventParticipation(1, 1); $this->assertEquals(true, $state); }
public function show() { $id = (int) $this->getParams()[0]; $event = $this->eventModel->get($id); if (empty($event)) { throw new EventNotFoundException($id); } $event = $this->getInfos($event); $participate = Authentication::getInstance()->isAuthenticated() ? $this->eventModel->getParticipateUser($id, Authentication::getInstance()->getUserId()) : null; $event['mine'] = Authentication::getInstance()->isAuthenticated() ? $event['user']['id'] == Authentication::getInstance()->getUserId() : false; $participateModel = new ParticipateModel(); $userParticipating = $participateModel->getEventParticipation($id); $comments = $this->eventCommentModel->getCommentsForEvent($id); $userList = array(); foreach ($userParticipating as $key => $value) { $userList[] = $value['username']; } $this->getView()->render('event/show', array('event' => $event, 'participate' => $participate, 'comments' => $comments, 'users' => $userList)); }