예제 #1
0
 public function testPassedTestAfterPreviousFails()
 {
     // Given
     $this->createResultForUserAndArea($this->user, $this->area, Question::RESULT_INVALID, 12, 4);
     $testResult = TestResult::fetchResult(self::$conn, $this->anotherUser, $this->course);
     $testResult->setStartedAt(time());
     $trial = $this->getTestTrial(Question::RESULT_CORRECT, 12, 12, 10);
     $this->fillRecord($this->area, 2, 1, 1);
     // When
     $testResult->completeTrial(self::$conn, $this->area, $trial);
     // Then
     $this->assertEquals(Question::RESULT_CORRECT, $testResult->getResult());
     $this->assertEquals(12, $testResult->getTotalQuestions());
     $this->assertEquals(12, $testResult->getPassedQuestions());
     $this->expectTestResult($this->user, Question::RESULT_INVALID, 1, 12, 4);
     $this->expectTestResult($this->anotherUser, Question::RESULT_CORRECT, 1, 12, 12);
     $this->expectAreaResult($this->anotherUser);
     $this->expectCourseProgress($this->area, 2, 2, 0);
 }
예제 #2
0
 public function getTestResult(User $user, Course $course)
 {
     return TestResult::fetchResult($this->conn, $user, $course);
 }