/** * Tests open_match by providing a match object * @covers BBTournament::open_match() */ public function test_open_match_invalid_team_pair() { $this->get_tournament_with_open_matches(); $match = $this->object->open_matches[0]; $team1 = $match->team(); $invalid_team = null; foreach ($this->object->teams() as $team) { if (!$match->team_in_match($team)) { $invalid_team = $team; break; } } $this->assertNull($this->object->open_match($team1, $invalid_team)); }
/** * If this team has an opponent waiting, this method can be used to get the * BBMatch object for the match, so that it can be reported * * @return BBMatch|null */ public function &match() { if ($this->orphan_error()) { return $this->bb->ref(null); } //Already cached if (!is_null($this->match)) { return $this->match; } //No opponent - can't make a match if (is_null($this->opponent())) { return $this->bb->ref(null); } //Use tournament to create the BBModel object, cache it, and return $this->match =& $this->tournament->open_match($this, $this->opponent); return $this->match; }