Ejemplo n.º 1
0
 public function testExamQuestionsToReviewLater()
 {
     $exam = new Exam();
     // At the begining of the exam there should not be answer to be reviewed later
     $this->assertFalse($exam->hasQuestionsToReview());
     // Add ten questions to this exam
     $questions = array();
     for ($i = 0; $i < 10; $i++) {
         $question = \Mockery::mock('Question');
         // Expect first five questions to be reviewed later
         $question->shouldReceive('reviewLater')->times($i < 5 ? 1 : 0)->andReturn();
         $question->shouldReceive('isMarkedToReviewLater')->andReturn($i < 5);
         $questions[] = $question;
     }
     $exam->setQuestions($questions);
     // Mark the first questions to be reviewed later
     for ($id = 0; $id < 5; $id++) {
         $exam->reviewQuestionLater($id, TRUE);
     }
     // There should be some questions to be reviewed later
     $this->assertTrue($exam->hasQuestionsToReview());
 }