/** * Adds 8 confirmed teams to the tournament reference * @param BBTournament $tournament * @param boolean $save */ protected function add_tournament_teams(BBTournament &$tournament, $save = true) { //Must start with an ID $this->assertSave($tournament->save()); //Add 8 players $countries = array('USA', 'GBR', 'USA', 'NOR', 'JPN', 'SWE', 'NOR', 'GBR'); for ($x = 0; $x < 8; $x++) { $team = $tournament->team(); $team->confirm(); $team->display_name = 'Player ' . ($x + 1); $team->country_code = $countries[$x]; } if ($save) { $this->assertTrue($tournament->save_teams()); } }