public function testWonGamePairs() { $gameService = new GameService(); $gameService->setManager($this->em); $wonMatch = $gameService->wonGameByPairs(1, 2, []); $this->assertEquals($wonMatch, null); }
public function resolveDraw($pair1, $pair2, $rank, $games) { $gameService = new GameService(); $gameService->setManager($this->em); $resultWonGame = $gameService->wonGameByPairs($pair1, $pair2, $games); if ($resultWonGame == $pair2) { $first = 0; foreach ($rank as $r) { if ($r['pair'] == $pair1) { $tmp1 = $r; } else { if ($r['pair'] == $pair2) { $tmp2 = $r; } } } $rankNew = array(); foreach ($rank as $r) { if ($r['pair'] == $pair1 || $r['pair'] == $pair2) { if ($first == 0) { $rankNew[] = $tmp2; $first = 1; } else { $rankNew[] = $tmp1; } } else { $rankNew[] = $r; } } return $rankNew; } return $rank; }