public function testSortByClassified() { $inscriptions = [$this->inscription1, $this->inscription2, $this->inscription3, $this->inscription4, $this->inscription5]; $inscriptionsExpected = [$this->inscription2, $this->inscription3, $this->inscription5, $this->inscription4, $this->inscription1]; $inscriptionService = new InscriptionService(); $inscriptionService->setManager($this->em); $inscriptionsResult = $inscriptionService->orderByClassified($inscriptions); $this->assertEquals($inscriptionsResult, $inscriptionsExpected); }
public function createDrawForCategory($inscriptions, $categoryId, $tournamentId) { $inscriptionService = new InscriptionService(); $inscriptionService->setManager($this->em); $inscriptions = $inscriptionService->orderByClassified($inscriptions); $numInscriptions = count($inscriptions); $drawLength = $this->getDrawLength($numInscriptions); $numPairsBye = $drawLength - $numInscriptions; for ($i = 0; $i < $numPairsBye; $i++) { $inscriptions[] = Literals::ByePairName; } $numMatchs = $drawLength / 2; $numMatchs = intval($numMatchs); $gamesOnDraw = $this->generateDraw($inscriptions, $numMatchs, $categoryId, $tournamentId); return $gamesOnDraw; }