/** * Calcula o score para cada candidato */ private function calculateCandidatesScores() { $candidates = $this->candidates->getIterator(); while ($candidates->valid()) { $candidates->current()->setScore(0); $candidateAnswers = $candidates->current()->getAnswersList()->getAnswersList(); $questions = $this->test->getQuestionsList()->getIterator(); while ($questions->valid()) { $answer = $questions->current()->getAnswer()->getAnswer(); if (!isset($candidateAnswers[$questions->key()]) || $candidateAnswers[$questions->key()] != $answer) { $questions->next(); continue; } $newScore = $candidates->current()->getScore() + $questions->current()->getScore(); $candidates->current()->setScore($newScore); $questions->next(); } $candidates->next(); } }
/** * @test */ public function gettersShouldGetAttributesCorrectly() { $this->assertSame('2000-01-01', $this->test->getDate()); $this->assertSame($this->questionsList, $this->test->getQuestionsList()); }