/** * Tests if the pairings array returns * the correct pairings count. */ public function testPairingsCorrectArrayReturned() { $tournamentID = 1; $fakePlayers = [0 => getFakePlayers(11)]; $expectedPairingsCount = 6; \Swiss::shouldReceive('roundsCount')->with($tournamentID)->once()->andReturn(1); $result = $this->pairingsHandler->ranked($fakePlayers, $tournamentID); $this->assertCount(6, $result); }
/** * Returns an array of fake pairings. * * @param int $count * * @return array */ function getFakePairings($count = 1, $withByes = false) { $fakePairings = []; for ($index = 0; $index < $count; $index++) { $playersCount = $withByes ? rand(1, 2) : 2; $fakePairings[] = getFakePlayers($playersCount); } return $fakePairings; }