コード例 #1
0
 public function testItShould_fetchRandomExercise()
 {
     $previousExerciseId = rand(1, 100);
     $exercise = $this->createExercise();
     $this->exerciseRepository->method('fetchRandomExerciseOfLesson')->with($this->lesson->id, $this->user->id, $previousExerciseId)->willReturn($exercise);
     $this->assertEquals($exercise, $this->lesson->fetchRandomExercise($this->user->id, $previousExerciseId));
 }
 public function test_percentOfGoodAnswersOfUser()
 {
     $result = rand(1, 100);
     $this->exerciseRepository->method('percentOfGoodAnswersOfUser')->with($this->exercise->id, $this->user->id)->willReturn($result);
     $this->assertEquals($result, $this->exercise->percentOfGoodAnswersOfUser($this->user->id));
 }