/**
  * @dataProvider quizProvider
  */
 public function testIsAllowed($userId, $isAllowed, $isActive, $decided, $numQuestions)
 {
     $quiz = new Quiz($userId, $this->em);
     $this->assertEquals($isAllowed, $quiz->isUserAllowed());
     $this->assertEquals($isActive, $quiz->isQuizActive());
     $this->assertEquals($decided, $quiz->decideWhatToDo());
     $this->assertEquals($numQuestions, count($quiz->getQuestionsForUser()));
 }
 public function getwinnersAction()
 {
     $quizset = $this->admin->getSubject();
     if (!$quizset) {
         throw new NotFoundHttpException(sprintf('unable to find the object with id : %s'));
     }
     $em = $this->getDoctrine()->getManager();
     try {
         $parsedData = Quiz::getQuizAnwsers(new QuizData($em), $quizset);
         return $this->render('AppBundle:begin:answer.html.twig', array('answers' => $parsedData));
     } catch (InvalidArgumentException $e) {
         $this->addFlash('sonata_flash_error', 'Nie ma danych');
         return new RedirectResponse($this->admin->generateUrl('list'));
     }
 }