示例#1
0
 public function testCalculateWithoutProvision()
 {
     $calculator = new Calculator();
     $user1 = new User();
     $user1->setElo(1313);
     $user1->setNbRatedGames(1256);
     $user2 = new User();
     $user2->setElo(1158);
     $user2->setNbRatedGames(124);
     $win = -1;
     list($newP1Elo, $newP2Elo) = $calculator->calculate($user1, $user2, $win);
     $this->assertEquals(1322, $newP1Elo);
     $this->assertEquals(1149, $newP2Elo);
 }
示例#2
0
 public function adjustElo(User $user, $elo)
 {
     $user->setElo($elo);
     $ts = date_create()->getTimestamp();
     $this->historyRepository->findOneByUserOrCreate($user)->addAdjust($ts, $elo);
 }